LlEventController.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace hd\controllers;
  3. use common\components\util;
  4. use Yii;
  5. class LlEventController extends BaseController
  6. {
  7. public $guestAccess = [];
  8. public function actionAdd()
  9. {
  10. $post = Yii::$app->request->post();
  11. $name = $post['name']??'';
  12. if(empty($name)){
  13. util::fail('请填写店名或姓名');
  14. }
  15. $no = $post['no']??'';
  16. if(!empty($no)){
  17. $pattern = '/^(?:\d{15}|\d{17}[\dxX])$/';
  18. $valid = preg_match($pattern, $no);
  19. if($valid == false){
  20. util::fail('身份证号错误');
  21. }
  22. }
  23. $mobile = $post['mobile']??'';
  24. $wx = $post['wx']??'';
  25. if(empty($wx) && empty($mobile) && empty($no)){
  26. util::fail('手机号、微信号、身份证必填一项');
  27. }
  28. $prove = $post['prove']??[];
  29. if(empty($prove)){
  30. util::fail('证据最少要一张');
  31. }
  32. $json = json_encode($prove);
  33. $intro = $post['intro']??'';
  34. util::complete('添加成功');
  35. }
  36. }