| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace hd\controllers;
- use common\components\util;
- use Yii;
- class LlEventController extends BaseController
- {
- public $guestAccess = [];
- public function actionAdd()
- {
- $post = Yii::$app->request->post();
- $name = $post['name']??'';
- if(empty($name)){
- util::fail('请填写店名或姓名');
- }
- $no = $post['no']??'';
- if(!empty($no)){
- $pattern = '/^(?:\d{15}|\d{17}[\dxX])$/';
- $valid = preg_match($pattern, $no);
- if($valid == false){
- util::fail('身份证号错误');
- }
- }
- $mobile = $post['mobile']??'';
- $wx = $post['wx']??'';
- if(empty($wx) && empty($mobile) && empty($no)){
- util::fail('手机号、微信号、身份证必填一项');
- }
- $prove = $post['prove']??[];
- if(empty($prove)){
- util::fail('证据最少要一张');
- }
- $json = json_encode($prove);
- $intro = $post['intro']??'';
- util::complete('添加成功');
- }
- }
|