企微短剧业务系统

ThirdPlatformController.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: shensong
  5. * Date: 2022/6/27
  6. * Time: 11:20
  7. */
  8. namespace App\Http\Controllers\Admin;
  9. use App\Http\Controllers\Controller;
  10. use App\Log;
  11. use App\Models\PlatformOrderConf;
  12. use App\Service\MsgService;
  13. use App\Service\ThirdPlatformService;
  14. use Illuminate\Http\Request;
  15. class ThirdPlatformController extends Controller
  16. {
  17. // 修改客户所有标签
  18. public function updateCustomerTag(Request $request)
  19. {
  20. $params['add_tag'] = $request->input('add_tag');
  21. $params['corpid'] = $request->input('corpid');
  22. $params['phone'] = $request->input('phone');
  23. $platformId = $request->input('platform_id');
  24. $timestamp = $request->input('timestamp');
  25. $nonce = $request->input('nonce');
  26. $signature = $request->input('signature');
  27. // 将接收到的数据保存的日志文件中
  28. Log::logInfo('updateCustomerTag', $request->all(), 'thirdPlatform');
  29. // 查询app_id对应的token
  30. $conf = PlatformOrderConf::getTokenByPlatformId($platformId);
  31. if(empty($conf->token)) {
  32. return self::returnValue('平台标识有误', 5000);
  33. }
  34. // 数据校验
  35. $check = MsgService::checkSignatureNew($nonce, $timestamp, $conf->token, $platformId, $signature);
  36. if($check === false) {
  37. return self::returnValue('签名校验失败', 5001);
  38. }
  39. list($res, $code) = ThirdPlatformService::updateCustomerTag($params);
  40. return self::returnValue($res, $code);
  41. }
  42. }