|
@@ -8,6 +8,8 @@ use app\common\exception\UploadException;
|
|
|
use app\common\library\Upload;
|
|
|
use app\common\model\Ad;
|
|
|
use app\common\model\Area;
|
|
|
+use app\common\model\Feedback;
|
|
|
+use app\common\service\SmsSend;
|
|
|
use think\Cache;
|
|
|
use think\Config;
|
|
|
use think\File;
|
|
@@ -17,7 +19,7 @@ use think\File;
|
|
|
*/
|
|
|
class Common extends Api
|
|
|
{
|
|
|
- protected $noNeedLogin = ['agreement','ads','area','area_sort','area_tree','config','get_area','upload'];
|
|
|
+ protected $noNeedLogin = ['agreement','ads','area','area_sort','area_tree','config','get_area','upload','feedback'];
|
|
|
protected $noNeedRight="*";
|
|
|
/**
|
|
|
* 获取各种协议
|
|
@@ -115,26 +117,27 @@ class Common extends Api
|
|
|
}
|
|
|
/**
|
|
|
* 意见反馈
|
|
|
- * @ApiParams (name=type,description="类型")
|
|
|
- * @ApiParams (name=body,description=内容)
|
|
|
- * @ApiParams (name=contact,description=联系方式)
|
|
|
+ * @ApiParams (name=name,description="称呼")
|
|
|
+ * @ApiParams (name=phone,description=电话)
|
|
|
+ * @ApiParams (name=sms_code,description=验证码)
|
|
|
+ * @ApiParams (name=title,description=标题)
|
|
|
+ * @ApiParams (name=content,description=内容)
|
|
|
+ * @ApiParams (name=images,description=图片数组)
|
|
|
*/
|
|
|
public function feedback(){
|
|
|
$data=input();
|
|
|
$this->validate($data,[
|
|
|
- 'type'=>['require','max:32'],
|
|
|
- 'body'=>['require','max:250'],
|
|
|
- 'contact'=>['require','max:50'],
|
|
|
+ 'name'=>['require','max:10'],
|
|
|
+ 'phone'=>['require','integer','length:11'],
|
|
|
+ 'title'=>['require','max:10'],
|
|
|
+ 'content'=>['require','max:120'],
|
|
|
+ 'images'=>['require','array','max:3','min:1'],
|
|
|
+ 'images.0'=>['require','url'],
|
|
|
]);
|
|
|
- if($this->auth->getUser()->feedback()->whereTime('created_at','today')->count()>=1){
|
|
|
- $this->error('您今日已反馈过了');
|
|
|
- }
|
|
|
- $this->auth->getUser()->feedback()->save([
|
|
|
- 'type'=>$data['type'],
|
|
|
- 'body'=>$data['body'],
|
|
|
- 'contact'=>$data['contact'],
|
|
|
- ]);
|
|
|
- $this->success();
|
|
|
+ SmsSend::setMobile($data['phone'])->setCode($data['sms_code']??'')->check();
|
|
|
+ $feedback=new Feedback();
|
|
|
+ $feedback->allowField(true)->save($data);
|
|
|
+ $this->success('',$feedback);
|
|
|
}
|
|
|
/**
|
|
|
* 获取地区信息
|