You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

59 lines
1.4 KiB

<?php
namespace App\Controller;
use Hyperf\Di\Annotation\Inject;
use App\Constants\ErrorCode;
use App\Exception\BusinessException;
use App\Service\DeviceServiceInterFace;
class DeviceController extends BaseController
{
/**
* @Inject
* @var DeviceServiceInterFace
*/
protected $deviceService;
public function bind()
{
$validator = $this->validationFactory->make(
$this->request->all(),
[
'store_id' => 'required|nonempty|integer',
'device_name' => 'required|nonempty|alpha_num',
],
[
'store_id.required' => '参数不正确',
'store_id.nonempty' => '参数不正确',
'store_id.integer' => '参数不正确',
'device_name.required' => '参数不正确',
'device_name.nonempty' => '参数不正确',
'device_name.alpha_num' => '参数不正确',
]
);
if ($validator->fails()){
// Handle exception
$errorMessage = $validator->errors()->first();
$this->result(200,[],$errorMessage);
}
$store_id = $this->request->input('store_id');
$device_name = $this->request->input('device_name');
$sd = $this->deviceService->bindByStoreId($device_name,$store_id);
return $this->result(0,[$sd],'绑定成功');
}
public function list()
{
}
}