作者 王智

xiugai

@@ -261,28 +261,28 @@ class Config extends Api @@ -261,28 +261,28 @@ class Config extends Api
261 //Gift 261 //Gift
262 $IsHave = Db::name('message')->where(['user_id' => $UserId, 'ob_id' => $Params['ob_id'], 'type' => 2])->find(); 262 $IsHave = Db::name('message')->where(['user_id' => $UserId, 'ob_id' => $Params['ob_id'], 'type' => 2])->find();
263 if ($Params['gift_id'] != 0) { 263 if ($Params['gift_id'] != 0) {
264 - if (!empty($IsHave)) {  
265 - //update  
266 - if ($IsHave['gift_id'] != 0) {  
267 -// $this->error('只能送出一份礼物');  
268 - }  
269 - $data = [  
270 - 'gift_id' => $Params['gift_id']  
271 - ];  
272 - $Res = Db::name('message')->where(['user_id' => $UserId, 'ob_id' => $Params['ob_id'], 'type' => 2])->update($data);  
273 - } else {  
274 - //add  
275 - $data = [  
276 - 'user_id' => $UserId,  
277 - 'ob_id' => $Params['ob_id'],  
278 - 'type' => 2,  
279 - 'touser_id' => $ObInfo['user_id'],  
280 - 'message' => $Params['message'],  
281 - 'gift_id' => $Params['gift_id'],  
282 - 'createtime' => time()  
283 - ];  
284 - $Res = Db::name('message')->insert($data);  
285 - } 264 +// if (!empty($IsHave)) {
  265 +// //update
  266 +// if ($IsHave['gift_id'] != 0) {
  267 +//// $this->error('只能送出一份礼物');
  268 +// }
  269 +// $data = [
  270 +// 'gift_id' => $Params['gift_id']
  271 +// ];
  272 +// $Res = Db::name('message')->where(['user_id' => $UserId, 'ob_id' => $Params['ob_id'], 'type' => 2])->update($data);
  273 +// } else {
  274 + //add
  275 + $data = [
  276 + 'user_id' => $UserId,
  277 + 'ob_id' => $Params['ob_id'],
  278 + 'type' => 2,
  279 + 'touser_id' => $ObInfo['user_id'],
  280 + 'message' => $Params['message'],
  281 + 'gift_id' => $Params['gift_id'],
  282 + 'createtime' => time()
  283 + ];
  284 + $Res = Db::name('message')->insert($data);
  285 +// }
286 } else { 286 } else {
287 //Message 287 //Message
288 // if (!empty($IsHave)) { 288 // if (!empty($IsHave)) {
@@ -295,17 +295,17 @@ class Config extends Api @@ -295,17 +295,17 @@ class Config extends Api
295 // ]; 295 // ];
296 // $Res = Db::name('message')->where(['user_id' => $UserId, 'ob_id' => $Params['ob_id'], 'type' => 2])->update($data); 296 // $Res = Db::name('message')->where(['user_id' => $UserId, 'ob_id' => $Params['ob_id'], 'type' => 2])->update($data);
297 // } else { 297 // } else {
298 - //add  
299 - $data = [  
300 - 'user_id' => $UserId,  
301 - 'ob_id' => $Params['ob_id'],  
302 - 'type' => 2,  
303 - 'touser_id' => $ObInfo['user_id'],  
304 - 'message' => $Params['message'],  
305 - 'gift_id' => $Params['gift_id'],  
306 - 'createtime' => time()  
307 - ];  
308 - $Res = Db::name('message')->insert($data); 298 + //add
  299 + $data = [
  300 + 'user_id' => $UserId,
  301 + 'ob_id' => $Params['ob_id'],
  302 + 'type' => 2,
  303 + 'touser_id' => $ObInfo['user_id'],
  304 + 'message' => $Params['message'],
  305 + 'gift_id' => $Params['gift_id'],
  306 + 'createtime' => time()
  307 + ];
  308 + $Res = Db::name('message')->insert($data);
309 // } 309 // }
310 } 310 }
311 $this->Res($Res); 311 $this->Res($Res);