|
@@ -10,16 +10,13 @@ use think\Db;
|
|
|
*/
|
|
|
class Gift extends Api
|
|
|
{
|
|
|
- protected $noNeedLogin = ['getGiftList','getGiftType'];
|
|
|
+ protected $noNeedLogin = [];
|
|
|
protected $noNeedRight = '*';
|
|
|
- public $giftModel;
|
|
|
- public $gifttypeModel;
|
|
|
+
|
|
|
|
|
|
public function _initialize()
|
|
|
{
|
|
|
parent::_initialize();
|
|
|
- $this->giftModel = new \app\common\model\Gift();
|
|
|
- $this->gifttypeModel = new \app\common\model\GiftType();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -82,7 +79,7 @@ class Gift extends Api
|
|
|
{
|
|
|
$this->error("请选择礼物");
|
|
|
}
|
|
|
- $giftvalue = bcmul($giftinfo['value'],$number);
|
|
|
+ $giftvalue = bcmul($giftinfo['price'],$number);
|
|
|
|
|
|
//被赠送人信息
|
|
|
$touserinfo = Db::name('user')->where('id',$user_id)->find();
|
|
@@ -104,13 +101,14 @@ class Gift extends Api
|
|
|
|
|
|
// 添加礼物赠送记录表
|
|
|
$data = [
|
|
|
- 'user_id' => $this->auth->id,
|
|
|
- 'user_to_id' => $user_id,
|
|
|
- 'gift_id' => $giftinfo['id'],
|
|
|
- 'gift_name' => $giftinfo['name'],
|
|
|
- 'number' => $number,
|
|
|
- 'price' => $giftvalue,
|
|
|
- 'createtime' => time(),
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
+ 'user_to_id' => $user_id,
|
|
|
+ 'gift_id' => $giftinfo['id'],
|
|
|
+// 'gift_name' => $giftinfo['name'],
|
|
|
+ 'number' => $number,
|
|
|
+ 'price' => $giftinfo['price'],
|
|
|
+ 'total_price' => $giftvalue,
|
|
|
+ 'createtime' => time(),
|
|
|
];
|
|
|
$log_id = Db::name('gift_user_typing')->insertGetId($data);
|
|
|
if(!$log_id){
|
|
@@ -118,7 +116,6 @@ class Gift extends Api
|
|
|
$this->error('赠送失败');
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if($giftvalue > 0){
|
|
|
|
|
|
// 扣除当前用户余额
|
|
@@ -144,11 +141,11 @@ class Gift extends Api
|
|
|
|
|
|
//tag任务赠送金币
|
|
|
//搭讪奖励
|
|
|
- $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,15);
|
|
|
+ /*$task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,15);
|
|
|
if($task_rs === false){
|
|
|
Db::rollback();
|
|
|
$this->error('完成任务赠送奖励失败');
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
Db::commit();
|
|
|
$this->success('赠送成功');
|