Other.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace app\api\controller\mlbb;
  3. use app\api\library\mlbb\LvRenSdk;
  4. use think\Db;
  5. /**
  6. * 其他接口管理
  7. */
  8. class Other extends Mlbb
  9. {
  10. public function _initialize(){
  11. parent::_initialize();
  12. $this->getChannelId();
  13. }
  14. public function common()
  15. {
  16. $result = [
  17. "short_link" => '', // 推广锻炼(下载地址)
  18. "activity_status" => $this->activity_status,
  19. "activity_status_msg" => $this->activity_status_msg,
  20. "start_time" => $this->expiration_date['start'],
  21. "end_time" => $this->expiration_date['end'],
  22. ];
  23. $short_link = model('promotion_short_link')->where(['game_id' => 344, 'channel_id' => $this->channel_id, 'type' => 1])->value('short_link');
  24. if($short_link){
  25. $result['short_link'] = T_DOMAIN . '/' . $short_link;
  26. }
  27. return $this->resultSuccess($result);
  28. }
  29. // 礼包码导入
  30. public function importGift(){
  31. $mark_code = input('mark_code', '');
  32. $codeLists = input('codes');
  33. if(!$mark_code || !$codeLists){
  34. return $this->resultFail('参数有误!');
  35. }
  36. $codeLists = explode(',', $codeLists);
  37. // 去除重复已存在
  38. $res = Db::table('lr_prize_gift')->where(['code' => ['in', $codeLists]])->column('code');
  39. $newArray = array_values(array_diff($codeLists, $res));
  40. if(count($newArray) <= 0){
  41. return ['code' => -102, 'msg' => '导入码为空!', 'data' => []];
  42. }
  43. $res = (new \app\api\service\mlbb\HandleService())->importGift($mark_code, $newArray);
  44. if($res['code'] != 200){
  45. return $this->resultFail($res['msg']);
  46. }
  47. return $this->resultSuccess([], '导入成功!');
  48. }
  49. public function getTest(){
  50. $mark_code = input('mark_code', '');
  51. // $result = (new LvRenSdk())->getRoleList();
  52. // $result = (new LvRenSdk())->getTagAndValByRole();
  53. // $result = (new \app\api\service\mlbb\HandleService())->getCacheGiftNum();
  54. // // dump($result);
  55. // return $this->resultSuccess($result['data']);
  56. }
  57. }