12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace app\common\model;
- use app\hander\HelpHander;
- use think\Db;
- class AttendanceMachineCmd extends Base{
- public function add($machine_id,$title,$command){
- $data = [
- 'machine_id' => $machine_id,
- 'title' => $title,
- 'command' => $command,
- 'create_time' => date('Y-m-d H:i:s'),
- 'enable' => 0
- ];
- $ret = Db::name('attendance_machine_cmd')->insert($data);
- if(!$ret){
- $this->error = '操作失败';
- return false;
- }
- return true;
- }
- // 更新超级管理员信息
- public function updateAdminInfo($machine_id,$userId,$name,$card){
- // C:${CmdID}:DATA${SP}UPDATE${SP}USERINFO${SP}PIN=${XXX}${HT}Name=${XXX}${HT}Pri=${XXX}${HT}Passwd=${XXX}${HT}Card=${XXX}${HT}Grp=${XXX}${HT}TZ=${XXX}${HT}Verify=${XXX}${HT}ViceCard=${XXX}
- $command = 'C:${CmdID}'.":DATA UPDATE USERINFO PIN={$userId}\tName={$name}\tPri=14\tPasswd=123456\tCard={$card}\tGrp=1\tTZ=0000000000000000\tVerify=3\tViceCard={$card}";
- $title = '更新用户ID:'.$userId.'['.$name.']的信息';
- return $this->add($machine_id,$title,$command);
- }
- // 更新用户信息
- public function updateUserInfo($machine_id,$userId,$name,$card){
- // C:${CmdID}:DATA${SP}UPDATE${SP}USERINFO${SP}PIN=${XXX}${HT}Name=${XXX}${HT}Pri=${XXX}${HT}Passwd=${XXX}${HT}Card=${XXX}${HT}Grp=${XXX}${HT}TZ=${XXX}${HT}Verify=${XXX}${HT}ViceCard=${XXX}
- $command = 'C:${CmdID}'.":DATA UPDATE USERINFO PIN={$userId}\tName={$name}\tPri=0\tPasswd=123456\tCard={$card}\tGrp=1\tTZ=0000000000000000\tVerify=15\tViceCard={$card}";
- $title = '更新用户ID:'.$userId.'['.$name.']的信息';
- return $this->add($machine_id,$title,$command);
- }
- // 更新用户比对照片
- public function updateUserImg($machine_id,$userId,$name,$img){
- //C:${CmdID}:DATA${SP}UPDATE${SP}BIOPHOTO${SP}PIN=${XXX}${HT}Type=${XXX}${HT}Size=${XXX}${HT}Content=${XXX}${HT}Format=${XXX}${HT}Url=${XXX}${HT}PostBackTmpFlag=${XXX}
- $command = 'C:${CmdID}'.":DATA UPDATE BIOPHOTO PIN={$userId}\tType=9\tPostBackTmpFlag=0\tFormat=1\tUrl={$img}";
- $title = '更新用户ID:'.$userId.'['.$name.']的比对照片';
- return $this->add($machine_id,$title,$command);
- }
- // 标记命令已被使用
- public function setUseCmd($id,$error=0){
- $ret = $this->where('id',$id)->update(['enable' => 1, 'error' => $error, 'update_time' =>date('Y-m-d H:i:s')]);
- if(!$ret){
- return false;
- }
- return true;
- }
- }
|