customer_421
This commit is contained in:
@@ -568,7 +568,7 @@ class Customer extends HD_Controller
|
||||
private function get_tag($id)
|
||||
{
|
||||
$show = $res_td = [];
|
||||
$res = $this->mdCustomerTag->select(['status' => 1, 'pid' => 0], 'sort desc,id desc', 0, 0, 'id,name,type');
|
||||
$res = $this->mdCustomerTag->select(['status' => 1, 'pid' => 0, 'show<>' => 1], 'sort desc,id desc', 0, 0, 'id,name,type');
|
||||
if ($res) {
|
||||
$id && $res_td = $this->mdCustomerTagdata->select(['c_id' => $id], 'id desc', 0, 0, 't_id');//查找用户选择
|
||||
$tag_data = $res_td ? array_unique(array_column($res_td, 't_id')) : '';
|
||||
|
||||
@@ -25,11 +25,15 @@ class Tag extends HD_Controller
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$statusAry = $this->mdCustomerTag->statusAry();
|
||||
$typeAry = $this->mdCustomerTag->typeAry();
|
||||
$showAry = $this->mdCustomerTag->showAry();
|
||||
$lists = array();
|
||||
$where = ["status<>-1" => null, 'pid' => 0];
|
||||
if (strlen($params['status'])) {
|
||||
$where['status'] = $params['status'];
|
||||
}
|
||||
if (strlen($params['show'])) {
|
||||
$where['show'] = $params['show'];
|
||||
}
|
||||
if ($params['type']) {
|
||||
$where['type'] = $params['type'];
|
||||
}
|
||||
@@ -44,6 +48,7 @@ class Tag extends HD_Controller
|
||||
$setValue['type_name'] = $typeAry[$value['type']];
|
||||
$setValue['status'] = $value['status'];
|
||||
$setValue['status_name'] = $statusAry[$value['status']];
|
||||
$setValue['show_name'] = $showAry[$value['show']];
|
||||
$options = '';
|
||||
$res_tag = $this->mdCustomerTag->select(["status" => 1, 'pid' => $value['id']], "sort desc,id desc", 0, 0, 'id,name,sort');
|
||||
$res_tag && $options = implode(',', array_column($res_tag, 'name'));
|
||||
@@ -53,7 +58,7 @@ class Tag extends HD_Controller
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['showInfo'] = ['statusAry' => $statusAry, 'typeAry' => $typeAry];
|
||||
$this->data['showInfo'] = ['statusAry' => $statusAry, 'typeAry' => $typeAry, 'showAry' => $showAry];
|
||||
$this->data['_title'] = '客户标签列表';
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
return $this->show_view('/receiver/tag/lists', true);
|
||||
@@ -83,14 +88,15 @@ class Tag extends HD_Controller
|
||||
$name = $re['name'];
|
||||
$sort = $re['sort'];
|
||||
$type = $re['type'];
|
||||
$show = $re['show'];
|
||||
} else {
|
||||
$url = "/receiver/tag/add";
|
||||
$name = '';
|
||||
$sort = 0;
|
||||
$sort = $show = 0;
|
||||
$type = 'checkbox';
|
||||
}
|
||||
$this->data['showInfo'] = ['id' => $id, 'name' => $name, 'sort' => $sort, 'type' => $type,
|
||||
'typeAry' => $this->mdCustomerTag->typeAry(), 'url' => $url];
|
||||
$this->data['showInfo'] = ['id' => $id, 'name' => $name, 'sort' => $sort, 'type' => $type, 'show' => $show,
|
||||
'typeAry' => $this->mdCustomerTag->typeAry(), 'showAry' => $this->mdCustomerTag->showAry(), 'url' => $url];
|
||||
return $this->show_view('/receiver/tag/edit');
|
||||
}
|
||||
|
||||
@@ -105,7 +111,8 @@ class Tag extends HD_Controller
|
||||
if ($re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标签名称已存在了!');
|
||||
}
|
||||
$id = $this->mdCustomerTag->add(['name' => $params['name'], 'sort' => $params['sort'], 'type' => $params['type']]);
|
||||
$id = $this->mdCustomerTag->add(['name' => $params['name'], 'sort' => $params['sort'], 'type' => $params['type']
|
||||
, 'show' => $params['show']]);
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
@@ -132,8 +139,8 @@ class Tag extends HD_Controller
|
||||
$this->wx_qyapi->get_external_contact(['url' => 'edit_corp_tag', 'id' => $re['qy_id']
|
||||
, 'name' => $params['name'], 'order' => $params['sort']]);
|
||||
}
|
||||
$this->mdCustomerTag->update(['name' => $params['name'], 'sort' => $params['sort'], 'type' => $params['type']]
|
||||
, ['id' => $params['id']]);
|
||||
$this->mdCustomerTag->update(['name' => $params['name'], 'sort' => $params['sort'], 'type' => $params['type']
|
||||
, 'show' => $params['show']], ['id' => $params['id']]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,17 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">显示:</label>
|
||||
<div class="am-para-input" style="width: 30%">
|
||||
<select name="show">
|
||||
<? foreach ($showInfo['showAry'] as $key => $value) { ?>
|
||||
<option value="<?= $key ?>" <?= $key == $showInfo['show'] ? 'selected' : '' ?>
|
||||
><?= $value ?></option>
|
||||
<? } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">排序:</label>
|
||||
<div class="am-para-input" style="width: 30%">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
action="receiver/tag">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">类型:</label>
|
||||
<label class="am-para-label w80">类型:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="type">
|
||||
<option value="">选择类型</option>
|
||||
@@ -15,7 +15,19 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">状态:</label>
|
||||
<label class="am-para-label w80">显示:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="show">
|
||||
<option value="">选择显示</option>
|
||||
<? foreach ($showInfo['showAry'] as $key => $value) { ?>
|
||||
<option value="<?= $key ?>" <?= strlen($params['show']) && $key == $params['show'] ? 'selected' : '' ?>
|
||||
><?= $value ?></option>
|
||||
<? } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">状态:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="status">
|
||||
<option value="">选择状态</option>
|
||||
@@ -47,6 +59,7 @@
|
||||
<th width="25%"><span>名称</span></th>
|
||||
<th width="45%"><span>标签选项</span></th>
|
||||
<th width="7%"><span>类型</span></th>
|
||||
<th width="5%"><span>显示</span></th>
|
||||
<th width="5%"><span>排序</span></th>
|
||||
<th width="5%"><span>状态</span></th>
|
||||
</tr>
|
||||
@@ -58,11 +71,12 @@
|
||||
<td><?= $v['name'] ?></td>
|
||||
<td><?= $v['options'] ?></td>
|
||||
<td><?= $v['type_name'] ?></td>
|
||||
<td><?= $v['show_name'] ?></td>
|
||||
<td><?= $v['sort'] ?></td>
|
||||
<td><?= $v['status_name'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" class="align-r">
|
||||
<td colspan="6" class="align-r">
|
||||
<a href="javascript:void(0);" @click="optionsModal(<?= $v['id'] ?>,'<?= $v['name'] ?>')"
|
||||
class="am-btn am-btn-primary am-btn-xs">编辑选项</a>
|
||||
<a href="javascript:void(0);" data-modal="/receiver/tag/get?id=<?= $v['id'] ?>"
|
||||
|
||||
@@ -98,7 +98,7 @@ class Customers extends Wxapp
|
||||
{
|
||||
$id = intval($this->input_param('id'));
|
||||
$show = $res_td = [];
|
||||
$res = $this->mdCustomerTag->select(['status' => 1, 'pid' => 0], 'sort desc,id desc', 0, 0, 'id,name,type');
|
||||
$res = $this->mdCustomerTag->select(['status' => 1, 'pid' => 0, 'show<>' => 1], 'sort desc,id desc', 0, 0, 'id,name,type');
|
||||
if ($res) {
|
||||
if ($id) {
|
||||
$res_td = $this->mdCustomerTagdata->select(['c_id' => $id], 'id desc', 0, 0, 't_id');
|
||||
|
||||
@@ -16,6 +16,17 @@ class Receiver_customer_tag_model extends HD_Model
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:显示位置
|
||||
* Created on: 2022/4/21 14:24
|
||||
* Created by: dengbw
|
||||
* @return array
|
||||
*/
|
||||
public function showAry()
|
||||
{
|
||||
return [0 => '不限', 1 => '仅企微'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:选项类型
|
||||
* Created on: 2022/3/15 14:07
|
||||
@@ -24,7 +35,7 @@ class Receiver_customer_tag_model extends HD_Model
|
||||
*/
|
||||
public function typeAry()
|
||||
{
|
||||
return array('checkbox' => '多选', 'radio' => '单选');
|
||||
return ['checkbox' => '多选', 'radio' => '单选'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,7 +46,7 @@ class Receiver_customer_tag_model extends HD_Model
|
||||
*/
|
||||
public function statusAry()
|
||||
{
|
||||
return array(1 => '正常', 0 => '禁用');
|
||||
return [1 => '正常', 0 => '禁用'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user