LlEventController.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace hd\controllers;
  3. use bizHd\ll\classes\LlEventClass;
  4. use common\components\util;
  5. use Yii;
  6. class LlEventController extends BaseController
  7. {
  8. public $guestAccess = [];
  9. public function actionList()
  10. {
  11. $get = Yii::$app->request->get();
  12. $requestType = $get['requestType'] ?? '';
  13. $where = [];
  14. if ($requestType == 'my') {
  15. $shopId = $this->shopId;
  16. $where['launchShopId'] = $shopId;
  17. }
  18. $respond = LlEventClass::getEventList($where);
  19. util::success($respond);
  20. }
  21. public function actionAdd()
  22. {
  23. $post = Yii::$app->request->post();
  24. $name = $post['name']??'';
  25. if(empty($name)){
  26. util::fail('请填写店名或姓名');
  27. }
  28. $no = $post['no']??'';
  29. if(!empty($no)){
  30. $pattern = '/^(?:\d{15}|\d{17}[\dxX])$/';
  31. $valid = preg_match($pattern, $no);
  32. if($valid == false){
  33. util::fail('身份证号错误');
  34. }
  35. }
  36. $mobile = $post['mobile']??'';
  37. $wx = $post['wx']??'';
  38. if(empty($wx) && empty($mobile) && empty($no)){
  39. util::fail('手机号、微信号、身份证必填一项');
  40. }
  41. $prove = $post['prove']??[];
  42. if(empty($prove)){
  43. util::fail('证据最少要一张');
  44. }
  45. $shop = $this->shop;
  46. $respond = LlEventClass::addEvent($post,$shop);
  47. util::success($respond);
  48. }
  49. }