Commit 0828c607 authored by sugar's avatar sugar

姓名卡

parent b8bce789
......@@ -166,14 +166,17 @@ class Namecard extends Backend
$offset = 1;
}
$cards = [];
$data['type'] = 1;//二维码类型 1=邀请锁客
$data['type'] = 1;//二维码类型 1=认领
$numLen = 12; //卡号编码位数
$pwdLen = 7;//激活码位数
$sNumArr = range(0, 7);
$sNumArr = range(0, 9);
$sPwdArr = array_merge($sNumArr, range('A', 'Z'));
for ($x = 0; $x < $c; $x++) {
$tempPwdStr = array();
for ($i = 0; $i < $pwdLen; $i++) {
if(array_rand($sPwdArr) == 'I'){
continue;
}
$tempPwdStr[] = $sPwdArr[array_rand($sPwdArr)];
}
$numbers = $offset++;
......@@ -181,7 +184,7 @@ class Namecard extends Backend
$cards[$x]['card_number'] = $card_number;//卡号
$cards[$x]['activation_code'] = implode('', $tempPwdStr);//激活码
$cards[$x]['createtime'] = time();//创建时间
$cards[$x]['url'] = createQrcode($data,$data['type'],'');
$cards[$x]['url'] = createQrcode($data,$data['type'],$card_number);
}
array_unique($cards, SORT_REGULAR);
$result = $this->model->insertAll($cards);
......
......@@ -14,5 +14,6 @@ return [
'Createtime' => '创建时间',
'Status' => '状态',
'Status 1' => '显示',
'Family_id' =>'族谱',
'Status 2' => '隐藏'
];
......@@ -2,6 +2,7 @@
namespace app\api\controller;
use app\admin\model\family\Namecard;
use app\common\controller\Api;
/**
......@@ -38,4 +39,20 @@ class Index extends Api
$data['im_msg_text'] = "对方还未认领,请通知对方及时认领";
$this->success('请求成功',$data);
}
/**
* @description: 扫码进入,判断此券有无被绑定
* @param {type}
* @return:
*/
public function scanNameCard()
{
$card_number = $this->request->post('card_number', ''); //券编号
$namecard = Namecard::where(['card_number' => $card_number])->find();
if ($namecard['user_id']) {
$this->error('此卡已被激活');
} else {
$this->success('此卡可绑', ['namecard' => $namecard]);
}
}
}
......@@ -655,7 +655,7 @@ if (!function_exists('getRecursion')) {
$url = "https://" . $_SERVER['HTTP_HOST'] . "/".$methodname."?";
$qrcodeName = null;
// $data['card_number']=$card_number;
$data['card_number']=$card_number;
foreach ($data as $key => $val) {
if (!empty($val)) {
......@@ -666,7 +666,6 @@ if (!function_exists('getRecursion')) {
$url = substr($url, 0, strlen($url) - 1);
$qrcodeName = substr($qrcodeName, 0, strlen($qrcodeName) - 1);
// return $qrcodeName.'.png';
$file = \app\lib\QrcodeUtil::createQrcode($url, $data, $qrcodeName);
return $file;
}
......
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