| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace app\api\controller;
- use app\api\service\CustomerService;
- use app\api\validate\AddCustomerValidate;
- use app\api\validate\LoginValidate;
- use app\common\model\CustomerModel;
- use app\Request;
- use think\App;
- class Customer extends \app\BaseController
- {
- private $service;
- public function __construct(App $app)
- {
- $this->service = new CustomerService();
- parent::__construct($app);
- }
- public function add(Request $request) {
- $params = (new AddCustomerValidate())->message([
- 'name_zh.require' => lang("The customer name_zh does not comply with the rule"),
- 'name_en.require' => lang("The customer name_en does not comply with the rule"),
- 'mobile.require' => lang("The mobile does not comply with the rule"),
- 'address.require' => lang("The address does not comply with the rule"),
- 'email.email' => lang("The email does not comply with the rule"),
- 'sex.require' => lang("The sex does not comply with the rule"),
- 'linkman.require' => lang("The linkman does not comply with the rule"),
- 'zue_coin.require' => lang("The zue_coin does not comply with the rule"),
- 'sun_calendar.require' => lang("The sun_calendar does not comply with the rule"),
- 'lunar_calendar.require' => lang("The lunar_calendar does not comply with the rule"),
- ])->requestBodyCheck($request);
- $res = $this->service->add($params);
- predicate($res->bool, $res->message);
- return $this->ok($res->data);
- }
- }
|