Commit 1ac59181 by LiuJunYi

VIP加入会员卡

parent ec87e7f1
......@@ -296,17 +296,7 @@ class Project extends AuthBase
//删除标签
public function deleteTag()
{
$id = input('post.id');
$used = $this->project_model->where('tags', 'like', "%" . '|' . $id . '|' . "%")->count();
if ($used > 0) {
$this->error('该标签已在项目中引用,不可删除!', '', '', 1);
}
$res = model('tags')->destroy($id);
if ($res) {
$this->success('删除成功', '', '', 1);
} else {
$this->error('删除失败', '', '', 1);
}
//查询
}
// 预约管理
......
......@@ -45,6 +45,11 @@ class User extends AuthBase
$user_model = model('user');
$user_list = $user_model->where($condition)->order('created_at desc')
->paginate(10,['query'=>['nickname'=>$nickname,'is_vip'=>$is_vip,'start_time'=>$start_time,'end_time'=>$end_time,'phone'=>$phone]]);
//把编号字符串分割
foreach($user_list as &$v){
$numberArr = str_split($v['vip_number'], 4);
$v['vip_number'] = implode(' ', $numberArr);
}
$this->assign('user_list',$user_list);
return $this->fetch();
......
......@@ -53,6 +53,7 @@
<th>联系方式</th>
<th>所在地</th>
<th>会员</th>
<th>会员卡号</th>
<th>微信号</th>
<th>地址</th>
<th>会员到期时间</th>
......@@ -87,6 +88,11 @@
非会员
{/if}
</td>
<td>
{if condition="$vo.is_vip == 1"}
{$vo.vip_number}
{/if}
</td>
<td>{$vo.wx_number}</td>
<td>{$vo.address}</td>
<td>
......
......@@ -152,7 +152,7 @@ class User extends Base
$result = ['phone' => $phone, 'hidephone' => $hidephone];
//关联VIP
$is_relation = $this->vipRelation($phone);
return ["code" => 0, "msg" => "获取成功", 'data' => $result,'is_relation'=>$is_relation];
return ["code" => 0, "msg" => "获取成功", 'data' => $result, 'is_relation' => $is_relation];
} else {
return ["code" => 1, "msg" => "微信数据解密失败,请重试!"];
}
......@@ -163,14 +163,14 @@ class User extends Base
//先查询最新的是否有未关联的这个手机号
$relation = VipRelationModel::get(['mobile' => $phone, 'is_relation' => 0]);
if (!$relation) {
return false;
return false;
}
UserModel::where('phone', $phone)->update([
'is_vip' => 1,
'is_vip' => 1,
'vip_endtime' => $relation['vip_expire'],
'name'=>$relation['nickname'],
'address'=>$relation['address'],
'wx_number'=>$relation['wx_number'],
'name' => $relation['nickname'],
'address' => $relation['address'],
'wx_number' => $relation['wx_number'],
]);
$relation->is_relation = 1;
$relation->save();
......@@ -196,10 +196,18 @@ class User extends Base
$user['vip_endtime_str'] = '';
}
$user['hidephone'] = substr_replace($user['phone'], '****', 3, 4);
//查询是否存在编号
if (empty($user['vip_number'])) {
UserModel::where('id', $user['id'])->update(['vip_number' => 'MXZ' . base_convert(uniqid(), 16, 10)]);
$user['vip_number'] = 'MXZ' . base_convert(uniqid(), 16, 10);
halt($user);
}
//把编号字符串分割
$numberArr = str_split($user['vip_number'], 4);
$user['vip_number'] = implode(' ', $numberArr);
return ['code' => 0, 'msg' => 'success', 'data' => $user];
}
/**
* 更新用户
* @url /api/User/update
......
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