Commit 2bb1488f authored by clone's avatar clone

验证器

parent 618d214c
...@@ -10,19 +10,21 @@ namespace app\api\controller; ...@@ -10,19 +10,21 @@ namespace app\api\controller;
*/ */
use app\api\extend\Basic; use app\api\extend\Basic;
use app\api\untils\WxCallbackUntils; use think\Request;
class WxSdk extends Basic class WxSdk extends Basic
{ {
private $wxCallbackApi;
public function __construct()
{
parent::__construct();
$this->wxCallbackApi = new WxCallbackUntils();
}
public function __construct($request = null)
{
parent::__construct($request);
}
public function saveWxInfo(){
$params = $this->params;
$params = array(
"wang"
);
}
} }
<?php
namespace app\api\validate;
use think\Validate;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/6/6
* Time : 17:35
* Intro:
*/
class UWxInfoValidate extends Validate
{
protected $rule = [
'wx_open_id' => 'require',
'sex' => 'require|number',
];
protected $message = [
'wx_open_id.require' => '微信open_id不能为空',
'sex.require' => '性别为必须字段',
'sex.number' => '性别必须是数字',
];
protected $scene = [
'add' => [ 'wx_open_id', 'sex' ],
'select' => [ 'wx_open_id' ],
];
}
\ No newline at end of file
<?php
namespace app\model;
use app\api\validate\UWxInfoValidate;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/6/6
* Time : 17:14
* Intro:
*/
class UWxInfo extends Model{
// 设置当前模型对应的完整数据表名称
protected $table = 'u_wx_info';
private $validate_ ;
public function __construct()
{
$this->validate_ = new UWxInfoValidate();
}
public function addWxInfo($params){
$this->validate_->validate
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment