|
@@ -41,8 +41,6 @@ class User extends Api
|
|
|
if (!Config::get('fastadmin.usercenter')) {
|
|
|
$this->error(__('User center already closed'));
|
|
|
}
|
|
|
- $this->taskModel = new \app\common\model\Task();
|
|
|
- $this->tasklogModel = new \app\common\model\TaskLog();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1875,79 +1873,9 @@ class User extends Api
|
|
|
$data = $this->userInfo('return');
|
|
|
$data['gender'] = $edit_data['gender'];
|
|
|
$data['avatar'] = $edit_data['avatar'];
|
|
|
-// $this->success('success', $data);
|
|
|
|
|
|
- // 如果是女用户,则停止账户使用
|
|
|
- /*if ($gender == 0){
|
|
|
- Db::name('user')->where('id',$user_id)->update(['status'=>0,'is_closed'=>1]);//金庸
|
|
|
- Db::name('user_token')->where('user_id',$user_id)->delete();//金庸
|
|
|
- }*/
|
|
|
+ $this->success('success', $data);
|
|
|
|
|
|
- //领取任务奖励
|
|
|
- $task_id = 22; // 任务ID
|
|
|
- // 查询任务信息
|
|
|
- $taskInfo = $this->taskModel->where(["id"=>$task_id])->find();
|
|
|
- if(!$taskInfo) {
|
|
|
-// $this->error("任务信息未找到!");
|
|
|
- $this->success('success', $data);
|
|
|
- }
|
|
|
- // 查询用户完成情况
|
|
|
- $where = [];
|
|
|
- $where["user_id"] = $user_id;
|
|
|
- $where["task_id"] = $task_id;
|
|
|
- $where["is_finish"] = 1;
|
|
|
- if($taskInfo["type_id"] == 2){
|
|
|
- $where["finish_date"] = date("Ymd");
|
|
|
- }
|
|
|
- $tasklogInfo = $this->tasklogModel->where($where)->find();
|
|
|
- if(!$tasklogInfo) {
|
|
|
-// $this->error("任务还未完成哦!");
|
|
|
- $this->success('success', $data);
|
|
|
- }
|
|
|
- if($tasklogInfo["is_reward"] == 1) {
|
|
|
-// $this->error("任务奖励已领取,请勿重复领取!");
|
|
|
- $this->success('success', $data);
|
|
|
- }
|
|
|
- Db::startTrans();
|
|
|
- // 增加用户经验值
|
|
|
- //$res1 = \app\common\model\User::addEmpirical($user_id,$taskInfo["exp"]);
|
|
|
- $res1['status'] = true;
|
|
|
- if ($gender == 1) {
|
|
|
- //男用户获得金币
|
|
|
- $res1 = model('wallet')->lockChangeAccountRemain($user_id,0, 'gold', $taskInfo["exp"], 61, '完成' . $taskInfo['name'] . '任务', 'task_log', $tasklogInfo['id']);
|
|
|
- if ($res1['status'] === false) {
|
|
|
- Db::rollback();
|
|
|
-// $this->error($res1['msg']);
|
|
|
- $this->success('success', $data);
|
|
|
- }
|
|
|
- } elseif ($gender == 0) {
|
|
|
- $bili = config('site.money_to_gold'); //钱和金币兑换比例
|
|
|
- if ($bili > 0) {
|
|
|
- //女用户获得积分
|
|
|
- $money = bcdiv($taskInfo['exp'], $bili, 2);
|
|
|
- if ($money > 0) {
|
|
|
- $res1 = model('wallet')->lockChangeAccountRemain($user_id,0, 'money', $money, 67, '完成' .$taskInfo['name'] . '任务', 'task_log', $tasklogInfo['id']);
|
|
|
- if ($res1['status'] === false) {
|
|
|
- Db::rollback();
|
|
|
-// $this->error($res1['msg']);
|
|
|
- $this->success('success', $data);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // 更新奖励领取状态
|
|
|
- $res2 = $this->tasklogModel->update(["is_reward"=>1],["task_id"=>$task_id,"user_id"=>$user_id]);
|
|
|
- //系统消息
|
|
|
- $msg_id = \app\common\model\Message::addMessage($user_id,'任务奖励','完成' . $taskInfo['name'] . '任务,获得任务奖励');
|
|
|
- if($res1['status'] === true && $res2) {
|
|
|
- Db::commit();
|
|
|
-// $this->success("领取成功!");
|
|
|
- $this->success('success', $data);
|
|
|
- } else {
|
|
|
- Db::rollback();
|
|
|
-// $this->error("领取失败!");
|
|
|
- $this->success('success', $data);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
//真人认证后修改头像前比对
|