增加后台操作金额接口
This commit is contained in:
parent
a12ce6b174
commit
ffdd451b1d
|
@ -3,6 +3,7 @@
|
||||||
namespace app\controller\admin\api\v1;
|
namespace app\controller\admin\api\v1;
|
||||||
|
|
||||||
use app\dao\UserDao;
|
use app\dao\UserDao;
|
||||||
|
use app\dao\UserRewardDao;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
use App\Utils\ApiResponse;
|
use App\Utils\ApiResponse;
|
||||||
use App\model\Admin;
|
use App\model\Admin;
|
||||||
|
@ -186,7 +187,7 @@ class JobuserController
|
||||||
// 获取请求数据
|
// 获取请求数据
|
||||||
$data = $request->post();
|
$data = $request->post();
|
||||||
|
|
||||||
$user=User::where('username',$data['username'])->first();
|
$user = User::where('username', $data['username'])->first();
|
||||||
// 查询用户的手机号
|
// 查询用户的手机号
|
||||||
$UserPhone = UserPhone::where('user_id', $user->id)->get();
|
$UserPhone = UserPhone::where('user_id', $user->id)->get();
|
||||||
|
|
||||||
|
@ -199,12 +200,36 @@ class JobuserController
|
||||||
// 将手机号和总时间添加到结果数组中
|
// 将手机号和总时间添加到结果数组中
|
||||||
$userPhonesWithTime[] = [
|
$userPhonesWithTime[] = [
|
||||||
'phone' => $v->phone,
|
'phone' => $v->phone,
|
||||||
'total_time' => floor($time/60)
|
'total_time' => floor($time / 60)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$res['user']=$user;
|
$res['user'] = $user;
|
||||||
$res['userPhonesWithTime']=$userPhonesWithTime;
|
$res['userPhonesWithTime'] = $userPhonesWithTime;
|
||||||
// 返回计算结果
|
// 返回计算结果
|
||||||
return ApiResponse::success(200, $res);
|
return ApiResponse::success(200, $res);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @Apidoc\Title("1.0 增减用户积分")
|
||||||
|
* 减法传递 负数 正数增加
|
||||||
|
* @Apidoc\Url("admin/api/v1/Jobuser/add_money")
|
||||||
|
* @Apidoc\Method("POST")
|
||||||
|
* @Apidoc\Param("id", type="int",require=true, desc="用户id")
|
||||||
|
* @Apidoc\Param("money", type="int",require=true, desc="金额")
|
||||||
|
* @Apidoc\Param("memo", type="string",require=true, desc="备注")
|
||||||
|
*/
|
||||||
|
public function add_money(Request $request)
|
||||||
|
{
|
||||||
|
// 获取请求数据
|
||||||
|
$data = $request->post();
|
||||||
|
///用户id
|
||||||
|
$user_id = $data['id'];
|
||||||
|
//金额
|
||||||
|
$money = $data['money'];
|
||||||
|
//备注
|
||||||
|
$memo = $data['memo'];
|
||||||
|
UserRewardDao::sing($user_id, 30);
|
||||||
|
UserRewardDao::adjust($user_id, $money, $memo);
|
||||||
|
// 返回计算结果
|
||||||
|
return ApiResponse::success(200, []);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,13 @@ class UserRewardDao
|
||||||
{
|
{
|
||||||
self::base($userid, 7, $money, '签到');
|
self::base($userid, 7, $money, '签到');
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 人工调整
|
||||||
|
*/
|
||||||
|
public static function adjust($userid, $money,$memo)
|
||||||
|
{
|
||||||
|
self::base($userid, 2, $money, $memo);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 转账函数
|
* 转账函数
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue