增加商品管理和后台电话绑定
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
$config['mobile_list'] = array(
|
||||
'18600707490'
|
||||
'13077794729'
|
||||
);
|
||||
|
||||
@@ -15,7 +15,7 @@ class Clues extends HD_Controller
|
||||
$this->load->model('receiver/receiver_clues_cfrom_model', 'clues_cfrom_model');
|
||||
$this->load->model('receiver/receiver_customers_model', 'customers_model');
|
||||
$this->load->model('receiver/receiver_clue_oplogs_model', 'mdOplogs');
|
||||
// $this->load->model('receiver/receiver_xz_model', 'mdReceiverXz');
|
||||
$this->load->model('receiver/receiver_yx_model', 'mdReceiverXz');
|
||||
// $this->load->model('app/licheb/app_licheb_users_model');
|
||||
$this->load->model("biz/biz_model");
|
||||
// $this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
@@ -258,13 +258,6 @@ class Clues extends HD_Controller
|
||||
if ($row['duration']) {
|
||||
$rec_url = $row['rec_url'] ? build_qiniu_image_url($row['rec_url'], 0, 0, 'video') : '';
|
||||
$rec_text = '录音文件未生成';
|
||||
} else {
|
||||
$jsondata = json_decode($row['json_data'], true);
|
||||
if ($row['c_time'] > strtotime('2023-03-21 13:00:00')) {
|
||||
$rec_text = $this->mdReceiverXz->get_xz_status($jsondata['status']);
|
||||
$answer_text = $this->mdReceiverXz->get_xz_noAnswerReason($jsondata['noAnswerReason']);
|
||||
$answer_text && $rec_text .= "($answer_text)";
|
||||
}
|
||||
}
|
||||
}
|
||||
$setValue['rec_url'] = $rec_url;
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Items extends HD_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('item/item_model');
|
||||
$this->load->model("area_model");
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return $this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
!strlen($params['status']) && $params['status'] = '';
|
||||
$lists = array();
|
||||
$where = [];
|
||||
strlen($params['status']) && $where['status'] = intval($params['status']);
|
||||
$count = $this->item_model->count($where);
|
||||
$status_array = $this->item_model->status_array();
|
||||
if ($count) {
|
||||
$res = $this->item_model->select($where, "id desc", $params['page'], $params['size']);
|
||||
$province_ids = implode(',', array_unique(array_column($res, 'province_id')));
|
||||
$area_rows = [];
|
||||
if ($province_ids) {
|
||||
$area_where = [
|
||||
"province_id in ($province_ids)" => null
|
||||
];
|
||||
$area_rows = $this->area_model->map('province_id', '', $area_where, '', 0, 0, 'distinct(province_id), province_name');
|
||||
}
|
||||
foreach ($res as $key => $value) {
|
||||
$value['status_name'] = $status_array[$value['status']];
|
||||
$value['province_name'] = $value['province_id'] > 0 ? $area_rows[$value['province_id']][0]['province_name'] : '所有省份';
|
||||
$lists[] = $value;
|
||||
}
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
unset($status_array['-1']);
|
||||
$this->data['status_array'] = $status_array;
|
||||
$this->data['_title'] = '商品列表';
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
return $this->show_view('/receiver/items/lists', true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$id = intval($this->input->get('id'));
|
||||
$info = ['province_id' => 0];
|
||||
if ($id) {
|
||||
$info = $this->item_model->get(['id' => $id]);
|
||||
$info['src_img'] = build_qiniu_image_url($info['img']);
|
||||
}
|
||||
$this->data['provinces'] = $this->province_ary();
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = $id ? '编辑' : '新增';
|
||||
return $this->show_view('/receiver/items/edit', true);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$info = $this->input->post();
|
||||
$data = [
|
||||
'title' => $info['title'],
|
||||
's_time' => $info['s_time'],
|
||||
'e_time' => $info['e_time'],
|
||||
'img' => $info['img'],
|
||||
'province_id' => $info['province_id'],
|
||||
'descrip' => $info['descrip'],
|
||||
];
|
||||
$res = $this->item_model->add($data);
|
||||
if (!$res) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
//编辑单条数据
|
||||
public function edit()
|
||||
{
|
||||
$info = $this->input->post();
|
||||
$row = $this->item_model->get(['id' => $info['id']]);
|
||||
if (!$row) return $this->show_json(SYS_CODE_FAIL, '数据不存在');
|
||||
$up_data = [
|
||||
'title' => $info['title'],
|
||||
's_time' => $info['s_time'],
|
||||
'e_time' => $info['e_time'],
|
||||
'img' => $info['img'],
|
||||
'province_id' => $info['province_id'],
|
||||
'descrip' => $info['descrip'],
|
||||
];
|
||||
$res = $this->item_model->update($up_data, ['id' => $info['id']]);
|
||||
if (!$res) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function edit_status()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$row = $this->item_model->get(['id' => $id]);
|
||||
if (!$row) return $this->show_json(SYS_CODE_FAIL, '数据不存在');
|
||||
$status = $row['status'] ? 0 : 1;
|
||||
$up_data = [
|
||||
'status' => $status
|
||||
];
|
||||
$res = $this->item_model->update($up_data, ['id' => $id]);
|
||||
if (!$res) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<form id="vue-app" class="am-form am-form-horizontal" action="/biz/store/store/add?>" data-auto="true" method="post"
|
||||
style="width: 90%;padding-top: 10px">
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">标题:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入标题" name="biz_name" v-model="info.title"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">适用省份:</label>
|
||||
<div class="am-para-input w200">
|
||||
<select v-model="info.province_id">
|
||||
<option value="0">所有</option>
|
||||
<option v-for="value in provinces" :value="value.province_id">{{value.province_name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">有效时间:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" placeholder="开始时间" v-model="info.s_time" name="s_time"
|
||||
id="datetimepicker1" autocomplete="off">
|
||||
</div>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" placeholder="结束时间" v-model="info.e_time" name="e_time" id="datetimepicker2"
|
||||
autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0">
|
||||
<label class="am-para-label">图片:</label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm" data-file="1"
|
||||
data-type="jpg,png,gif,png,jpeg" data-uptype="qiniu" data-field="cover"><i
|
||||
class="am-icon-cloud-upload"></i> 选择图片<span style="color: blue"></span>
|
||||
</button>
|
||||
<input type="hidden" name="cover" id="cover_id"
|
||||
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)" v-model="info.img"
|
||||
class="layui-input">
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px" :src="info.src_img"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">商品说明:</label>
|
||||
<div class="am-para-input" style="min-height: 300px">
|
||||
<textarea id="editor" name="content" class="am-para-input">{{info.descrip}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-success" type="button" @click="submit">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
var vm = new Vue({
|
||||
el: '#vue-app',
|
||||
data: {
|
||||
info: <?=json_encode($info, JSON_UNESCAPED_UNICODE)?>,
|
||||
provinces: <?=json_encode($provinces, JSON_UNESCAPED_UNICODE)?>
|
||||
},
|
||||
mounted: function () {
|
||||
},
|
||||
methods: {
|
||||
submit: function () {
|
||||
let url = "receiver/items/add"
|
||||
if (this.info.id) {
|
||||
url = "receiver/items/edit"
|
||||
}
|
||||
this.info.img = $('#cover_id').val();
|
||||
this.info.descrip = CKEDITOR.instances.editor.getData();
|
||||
$.post(url, this.info, function (data) {
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1, end: function () {
|
||||
window.onhashchange.call();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
})
|
||||
},
|
||||
set_Stime: function (value) {
|
||||
this.info.s_time = value
|
||||
},
|
||||
set_Etime: function (value) {
|
||||
this.info.e_time = value
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
},
|
||||
watch: {}
|
||||
});
|
||||
require(['ckeditor'], function (ckeditor) {
|
||||
window.createEditor('[name="content"]');
|
||||
});
|
||||
require(['laydate'], function (laydate) {
|
||||
//日期范围
|
||||
laydate.render({
|
||||
elem: '#datetimepicker1',
|
||||
type: 'date',
|
||||
done: function (value, date) {
|
||||
vm.set_Stime(value)
|
||||
}
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#datetimepicker2',
|
||||
type: 'date',
|
||||
done: function (value, date) {
|
||||
vm.set_Etime(value)
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,91 @@
|
||||
<div class="coms-table-wrap mt10" id="vue-app">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="receiver/items/lists">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">状态:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="status" v-model="params.status">
|
||||
<option value="">选择状态</option>
|
||||
<option v-for="(value,key) in status_arr" :value="key">
|
||||
{{value}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml30">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button data-open="/receiver/items/get" type="button" data-title="新增"
|
||||
class="am-btn am-btn-success am-btn-sm w100">
|
||||
新增
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd" id="vue-show">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="8%"><span>id</span></th>
|
||||
<th width="25%"><span>标题</span></th>
|
||||
<th width="10%"><span>适用省份</span></th>
|
||||
<th width="10%"><span>开始时间</span></th>
|
||||
<th width="10%"><span>结束时间</span></th>
|
||||
<th width="5%"><span>状态</span></th>
|
||||
<th width="10%"><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="value in lists">
|
||||
<tr>
|
||||
<td>{{value.id}}</td>
|
||||
<td>{{value.title}}</td>
|
||||
<td>{{value.province_name}}</td>
|
||||
<td>{{value.s_time}}</td>
|
||||
<td>{{value.e_time}}</td>
|
||||
<td>{{value.status_name}}</td>
|
||||
<td>
|
||||
<button data-action="/receiver/items/edit_status" data-ajax="post" :data-params-id="value.id"
|
||||
class="am-btn am-btn-danger am-btn-xs">
|
||||
{{value.status==1?'下架':'上架'}}
|
||||
</button>
|
||||
<button :data-open="'/receiver/items/get?id='+value.id" class="am-btn am-btn-success am-btn-xs">
|
||||
修改
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var vue_obj;
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-app',
|
||||
data: {
|
||||
params: <?=json_encode($params, JSON_UNESCAPED_UNICODE)?>,
|
||||
status_arr: <?=json_encode($status_array, JSON_UNESCAPED_UNICODE)?>,
|
||||
lists: <?=json_encode($lists, JSON_UNESCAPED_UNICODE)?>,
|
||||
},
|
||||
mounted: function () {
|
||||
},
|
||||
methods: {},
|
||||
watch: {}
|
||||
});
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
@@ -20,8 +20,8 @@ class Yxcall extends HD_Controller
|
||||
$str = file_get_contents('php://input');
|
||||
debug_log('string:' . $str, $this->log_file);
|
||||
$data = json_decode($str, true);
|
||||
if ($data && $data['customerData']) {
|
||||
$row = $this->receiver_yx_model->get(array('call_id' => $data['customerData']));
|
||||
if ($data && $data['bindId']) {
|
||||
$row = $this->receiver_yx_model->get(array('bind_id' => $data['bindId']));
|
||||
if ($row) {
|
||||
$jsondata = json_decode($row['json_data'], true);
|
||||
$data['uname'] = $jsondata['uname'];
|
||||
@@ -58,9 +58,9 @@ class Yxcall extends HD_Controller
|
||||
$addData['customer_id'] = $row['cf_id'];
|
||||
}
|
||||
$this->mdOplogs->add($addData);
|
||||
$xcall = new Xcall($this->admin_config);
|
||||
$ycall = new Ycall();
|
||||
//解绑
|
||||
$xcall->SWunbind($data['to'], $data['virtualMobile']);
|
||||
$ycall->AXBUnbind($data['virtualMobile'], $data['calleeNumber']);
|
||||
} elseif ($row['cf_id'] && $row['cf_platform'] == 'api') { //理车宝
|
||||
$ycall = new Ycall();
|
||||
//解绑
|
||||
|
||||
@@ -51,6 +51,7 @@ class Yx extends Wxapp
|
||||
} else {
|
||||
$call_mobile = $result['middleNumber'];
|
||||
$add_data = [
|
||||
'bind_id' => $result['bindId'],
|
||||
'call_id' => $seq_id,
|
||||
'display_number' => $call_mobile,
|
||||
'biz_id' => $row['biz_id'],
|
||||
|
||||
@@ -5,8 +5,15 @@ class Item_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_items';
|
||||
|
||||
private $status_arr = [ '-1' => '删除',0 => '下架',1 => '正常'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
public function status_array()
|
||||
{
|
||||
return $this->status_arr;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user