diff --git a/application/adminapi/controller/Gift.php b/application/adminapi/controller/Gift.php index 1cb8c00..e7d8672 100644 --- a/application/adminapi/controller/Gift.php +++ b/application/adminapi/controller/Gift.php @@ -44,7 +44,12 @@ class Gift extends adminApi } } if($type == 2){ - $giftTypeData = db::name('vs_gift_label')->where('delete_time',0)->order("sort asc,id desc")->select(); + $type_id = input('type_id', 0); + $where['delete_time'] = 0; + if(!empty($type_id)){ + $where['tid'] = $type_id; + } + $giftTypeData = db::name('vs_gift_label')->where($where)->order("sort asc,id desc")->select(); foreach ($giftTypeData as $key => $value) { $giftType[$key]['id'] = $value['id']; $giftType[$key]['name'] = $value['name']; diff --git a/application/api/model/Activities.php b/application/api/model/Activities.php index d0acb1a..1d94f3b 100644 --- a/application/api/model/Activities.php +++ b/application/api/model/Activities.php @@ -36,21 +36,29 @@ class Activities extends Model Db::startTrans(); try { foreach ($gift_bag_detail as $k=>$v){ + $gift_id =0; + $gift_price = 0; + $gift_num = $v['quantity']; switch ($v['type']) { case 1: //金币 方法1:直接添加到用户钱包 + $gift_price = $v['quantity']; $res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::FIRST_CHARGE,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::FIRST_CHARGE)); break; case 2: //礼物 方法2:添加到用户礼物背包 + $gift_id = $v['foreign_id']; $res = model('UserGiftPack')->change_user_gift_pack($user_id,$v['foreign_id'],$v['quantity'],model('UserGiftPack')::FIRST_CHARGE,"首充好礼获得礼物"); break; case 3: //坐骑 方法3:添加到用户装扮 + $gift_id = $v['foreign_id']; $decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find(); if(empty($decorate_price_info)){ - continue; + break; } + $gift_price = $decorate_price_info['price']; $res = model('Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],5); break; case 4: //道具 方法5:钻石 + $gift_price = $v['quantity']; $res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPEARNINGS, model('common/UserWallet')::FIRST_CHARGE,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::FIRST_CHARGE)); default: break; @@ -59,15 +67,19 @@ class Activities extends Model Db::rollback(); return ['code' => 0, 'msg' => $res['msg'], 'data' => null]; } + // 记录日志 + //添加礼盒记录 + $reslut = Db::name('vs_gift_bag_receive_log')->insert([ + 'user_id' => $user_id, + 'gift_bag_id' => $gift_bag_id, + 'gift_id'=> $gift_id, + 'gift_price' => $gift_price, + 'num' => $gift_num, + 'bag_price' => $money, + 'createtime' => time(), + 'updatetime' => time() + ]); } - // 记录日志 - //添加礼盒记录 - $reslut = Db::name('vs_gift_bag_receive_log')->insert([ - 'user_id' => $user_id, - 'gift_bag_id' => $gift_bag_id, - 'createtime' => time(), - 'updatetime' => time() - ]); // 添加活动记录 $reslut = Db::name('vs_activities_receive')->insert([ 'user_id' => $user_id, @@ -111,7 +123,7 @@ class Activities extends Model case 3: //坐骑 方法3:添加到用户装扮 $decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find(); if(empty($decorate_price_info)){ - continue; + break; } $res = model('Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],6); break; diff --git a/application/api/model/Login.php b/application/api/model/Login.php index 5881670..c99edc9 100644 --- a/application/api/model/Login.php +++ b/application/api/model/Login.php @@ -135,7 +135,7 @@ class Login extends Model $return_res[$key]['tencent_im'] = ''; } - return ['code' => 1, 'msg' => '用户获取成功', 'data' => $return_res]; + return ['code' => 1, 'msg' => '用户获取成功!~', 'data' => $return_res]; }else{ $user_info = $phone_user['data'][0]; } @@ -262,17 +262,17 @@ class Login extends Model if (md5($password) != $user_info['password']) { return ['code' => 0, 'msg' => '密码错误', 'data' => null]; } - $multi_user = []; - //查询手机号绑定的账号 - $phone_user = $this->phone_login_query($user_name); - if($phone_user['code'] == 1){ - //获取返回数据的长度 - if(count($phone_user['data']) >= 2){ - $multi_user = $phone_user['data']; - } - } +// $multi_user = []; +// //查询手机号绑定的账号 +// $phone_user = $this->phone_login_query($user_name); +// if($phone_user['code'] == 1){ +// //获取返回数据的长度 +// if(count($phone_user['data']) >= 2){ +// $multi_user = $phone_user['data']; +// } +// } - $login = $this->login($user_info,$system,$login_device,$multi_user); + $login = $this->login($user_info,$system,$login_device); if($login['code'] != 1){ return $login; } diff --git a/application/api/model/UserData.php b/application/api/model/UserData.php index 5b60a02..4fe278b 100644 --- a/application/api/model/UserData.php +++ b/application/api/model/UserData.php @@ -260,7 +260,7 @@ class UserData extends Model db::startTrans(); //修改实名手机号 $red = db::name('user_auth')->where(['id' => $is_real['id']])->update(['mobile' => $new_mobile]); - $reslut = db::name('user')->where(['id' => $user_id])->update(['username' => $new_mobile]); + $reslut = db::name('user')->where(['id' => $user_id])->update(['username' => $new_mobile,'mobile' => $new_mobile]); if ($reslut && $red) { Db::commit(); return ['code' => 1, 'msg' => '修改成功','data' =>null]; @@ -269,7 +269,7 @@ class UserData extends Model return ['code' => 0, 'msg' => '修改失败','data' =>null]; } }else{ - $reslut = db::name('user')->where(['id' => $user_id])->update(['username' => $new_mobile]); + $reslut = db::name('user')->where(['id' => $user_id])->update(['username' => $new_mobile,'mobile' => $new_mobile]); if ($reslut) { return ['code' => 1, 'msg' => '修改成功','data' =>null]; }