Compare commits
46 Commits
Author | SHA1 | Date | |
---|---|---|---|
9a80aac0bb | |||
089f79072f | |||
c8f473ae85 | |||
676c680625 | |||
1d81f37aeb | |||
0cc064bd53 | |||
97225ce255 | |||
db1ceb8129 | |||
352bbe281b | |||
64cb3601aa | |||
ebc7f2be88 | |||
efc681ba9f | |||
737fd6a54c | |||
a0dbd35f2d | |||
8b13623e1f | |||
707ac960b9 | |||
7282f3d86b | |||
b200503f17 | |||
8414422b9a | |||
d66ec9932a | |||
83f116321b | |||
110b40a12a | |||
2b21d6d7e4 | |||
c1e7f1957c | |||
ce2134e95e | |||
357bc8a1a7 | |||
c0869f5ebc | |||
072c9ec838 | |||
897d7d7293 | |||
7b42452991 | |||
b3e3fdbc74 | |||
635690e8b8 | |||
5f98e51d9f | |||
fcc24f3a0d | |||
aae30527fc | |||
c887ded57e | |||
9c3c19e410 | |||
7d69bbac2b | |||
a01077514d | |||
71e34d3d40 | |||
e9848a6dc8 | |||
78833d7ae4 | |||
77372a13a7 | |||
ee4d778040 | |||
5fe55ae1c3 | |||
3578ee1b48 |
24
.drone.yml
24
.drone.yml
@ -1,7 +1,7 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: ssh
|
||||
name: car4s
|
||||
name: "服务器部署"
|
||||
|
||||
server:
|
||||
host: 110.40.192.42:8022
|
||||
@ -13,30 +13,26 @@ clone:
|
||||
disable: true
|
||||
|
||||
steps:
|
||||
- name: Git Set
|
||||
- name: "Git 设置"
|
||||
environment:
|
||||
GIT_NAME:
|
||||
from_secret: GIT_NAME
|
||||
GIT_PASSWD:
|
||||
from_secret: GIT_PASSWD
|
||||
commands:
|
||||
- echo "Git 设置"
|
||||
- cd /www/wwwroot/car.des8.com
|
||||
- git remote rm origin
|
||||
- git remote add origin http://heibai2006:4167208@git.des8.com/heibai2006/car4s.git
|
||||
#- echo "[remote \"origin\"]\n" > ~/.gitconfig
|
||||
#- echo "url = http://$GIT_NAME:$GIT_PASSWD@git.des8.com/heibai2006/car4s.git" > ~/.gitconfig
|
||||
- git remote add origin http://$GIT_NAME:$GIT_PASSWD@git.des8.com/$GIT_NAME/car4s.git
|
||||
|
||||
- name: Clone
|
||||
- name: "Clone 代码"
|
||||
commands:
|
||||
- echo "Clone 代码"
|
||||
- cd /www/wwwroot/car.des8.com
|
||||
- pwd && ls -l
|
||||
- git reset --hard
|
||||
- git pull origin master
|
||||
|
||||
- name: Env
|
||||
- name: "设置Env配置"
|
||||
commands:
|
||||
- echo "设置Env配置"
|
||||
- cd /www/wwwroot/car.des8.com
|
||||
- echo "[app]" > .env
|
||||
- echo "debug = false" >> .env
|
||||
@ -51,10 +47,14 @@ steps:
|
||||
- echo "debug = false" >> .env
|
||||
- cat .env
|
||||
|
||||
- name: Chown to www
|
||||
- name: "更改文件权限"
|
||||
commands:
|
||||
- echo "更改文件权限"
|
||||
- cd /www/wwwroot/car.des8.com
|
||||
- rm -rf ./runtime/cache
|
||||
- rm -rf ./runtime/temp
|
||||
- rm -rf ./public/.user.ini
|
||||
- chown -R www:www ./
|
||||
- echo "open_basedir=/www/wwwroot/car.des8.com/:/tmp/" > ./public/.user.ini
|
||||
- pwd && ls -l
|
||||
|
||||
|
||||
|
@ -11,6 +11,9 @@ use app\common\controller\Backend;
|
||||
use app\common\model\Attachment;
|
||||
use fast\Date;
|
||||
use think\Db;
|
||||
use think\Config;
|
||||
|
||||
use car\Sms;
|
||||
|
||||
/**
|
||||
* 控制台
|
||||
@ -29,8 +32,35 @@ class Dashboard extends Backend
|
||||
try {
|
||||
\think\Db::execute("SET @@sql_mode='';");
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
$user_ids=[1,2];
|
||||
// $list = User::where('id', 'in', $user_ids)->select();
|
||||
// $list = collection($list)->toarray();
|
||||
// $list = array_column($list, null, 'id');
|
||||
// var_dump($list);
|
||||
// $sms = new Sms(['userid' => 5838, 'account' => '盛世鑫鼎比亚迪', 'password' => '123456']);
|
||||
|
||||
// $prefix = Config::get('database.prefix');
|
||||
// $fieldArr = [];
|
||||
// $table = $prefix . 'user4s_user';
|
||||
// $database = Config::get('database.database');
|
||||
// $pk = Db::getTableInfo($table, 'pk');
|
||||
// $list = db()->query(
|
||||
// "SELECT COLUMN_NAME,COLUMN_COMMENT,COLUMN_TYPE,IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ? AND TABLE_SCHEMA = ?",
|
||||
// [$table, $database]
|
||||
// );
|
||||
// foreach ($list as $k => $v) {
|
||||
// if ($v['COLUMN_NAME'] !== $pk) {
|
||||
// $fieldArr[$v['COLUMN_COMMENT']] = $v; //['COLUMN_NAME']
|
||||
// }
|
||||
// }
|
||||
// var_dump($fieldArr);
|
||||
|
||||
//$sms->sendsms('15264925507','测试短信啊');
|
||||
//$sms->getStatus();
|
||||
// print_r($sms->send($user_ids,'【比亚迪汽车】如果搜[姓名]-将返回[联系方式]-要对数[余额]-进行[积分]-找且[性别]-要[车牌号码],退订回T'));
|
||||
// $sms->getStatus();
|
||||
$column = [];
|
||||
$starttime = Date::unixtime('day', -10);
|
||||
$endtime = Date::unixtime('day', 0, 'end');
|
||||
@ -49,9 +79,9 @@ class Dashboard extends Backend
|
||||
$this->assignconfig('column', array_keys($userlist));
|
||||
$this->assignconfig('userdata', array_values($userlist));
|
||||
//var_dump(Log::getlastsql());
|
||||
$joinlist = Log::where('state','=','0')
|
||||
$joinlist = Log::where('state', '=', '0')
|
||||
->where('createtime', 'between time', [$starttime, $endtime])
|
||||
->where('end','exp',' > start')
|
||||
->where('end', 'exp', ' > start')
|
||||
->field('createtime, SUM(end-start) AS price, DATE_FORMAT(FROM_UNIXTIME(createtime), "%Y-%m-%d") AS join_date')
|
||||
->group('join_date')
|
||||
->select();
|
||||
@ -68,31 +98,40 @@ class Dashboard extends Backend
|
||||
|
||||
//保险临期
|
||||
$start_date = strtotime("-1 year");
|
||||
$end_date = strtotime("+2 month",$start_date);
|
||||
$end_date = strtotime("+2 month", $start_date);
|
||||
$ins_where = array(
|
||||
'insdate'=>['between',[date('Y-m-d',$start_date),date('Y-m-d',$end_date)]]
|
||||
'insdate' => ['between', [date('Y-m-d', $start_date), date('Y-m-d', $end_date)]]
|
||||
);
|
||||
$ins_end = User::where($ins_where)->count();
|
||||
$ins_end = User::where(function ($query) {
|
||||
for ($y = 1; $y <= 20; $y++) {
|
||||
$start_date = strtotime("-" . $y . " year");
|
||||
$end_date = strtotime("+2 month", $start_date);
|
||||
$ins_where = array(
|
||||
'insdate' => ['between', [date('Y-m-d', $start_date), date('Y-m-d', $end_date)]]
|
||||
);
|
||||
$query->whereOr($ins_where);
|
||||
}
|
||||
})->count();
|
||||
$visit_where = array(
|
||||
'visittime'=>['<=',Date::unixtime('day', 0,'end')]
|
||||
'visittime' => ['<=', Date::unixtime('day', 0, 'end')]
|
||||
);
|
||||
$visit = Visit::where($visit_where)->where('status',0)->count();
|
||||
$visit = Visit::where($visit_where)->where('status', 0)->count();
|
||||
//今日生日
|
||||
$birthday_users = Db::query("select count(*) as num from car_user4s_user where MONTH(birthday) = MONTH(NOW()) and DAY(birthday) = DAY(NOW())");
|
||||
//var_dump(Db::getlastsql(), $birthday_users);
|
||||
$index_data = [
|
||||
'totaluser' => User::count(),
|
||||
'totalvipuser' => User::where('level_id','>','1')->count(),
|
||||
'todayprice' => Log::where('state','=','0')->whereTime('createtime', 'today')->where('end','exp',' > start')->sum('end-start'),
|
||||
'sumprice' =>Log::where('state','=','0')->where('end','exp',' > start')->sum('end-start'),
|
||||
'totalvipuser' => User::where('level_id', '>', '1')->count(),
|
||||
'todayprice' => Log::where('state', '=', '0')->whereTime('createtime', 'today')->where('end', 'exp', ' > start')->sum('end-start'),
|
||||
'sumprice' => Log::where('state', '=', '0')->where('end', 'exp', ' > start')->sum('end-start'),
|
||||
'totaladmin' => Admin::count(),
|
||||
'totalcategory' => \app\common\model\Category::count(),
|
||||
'todayusersignup' => User::whereTime('createtime', 'today')->count(),
|
||||
'todayusertovip' => Levellog::whereTime('createtime', 'today')->where('end','exp',' > start')->count(),
|
||||
'todayusertovip' => Levellog::whereTime('createtime', 'today')->where('end', 'exp', ' > start')->count(),
|
||||
'day7user' => User::whereTime('createtime', '-7 days')->count(),
|
||||
'day7price' => Log::where('state','=','0')->whereTime('createtime', '-7 days')->where('end','exp',' > start')->sum('end-start'),
|
||||
'day7price' => Log::where('state', '=', '0')->whereTime('createtime', '-7 days')->where('end', 'exp', ' > start')->sum('end-start'),
|
||||
'day3user' => User::whereTime('createtime', '-3 days')->count(),
|
||||
'day3price' => Log::where('state','=','0')->whereTime('createtime', '-3 days')->where('end','exp',' > start')->sum('end-start'),
|
||||
'day3price' => Log::where('state', '=', '0')->whereTime('createtime', '-3 days')->where('end', 'exp', ' > start')->sum('end-start'),
|
||||
// 'dbtablenums' => count($dbTableList),
|
||||
// 'dbsize' => array_sum(array_map(function ($item) {
|
||||
// return $item['Data_length'] + $item['Index_length'];
|
||||
@ -112,5 +151,4 @@ class Dashboard extends Backend
|
||||
$this->view->assign($index_data);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ use think\Config;
|
||||
use think\Hook;
|
||||
use think\Session;
|
||||
use think\Validate;
|
||||
use think\Request;
|
||||
|
||||
/**
|
||||
* 后台首页
|
||||
@ -113,6 +114,13 @@ class Index extends Backend
|
||||
}
|
||||
$background = Config::get('fastadmin.login_background');
|
||||
$background = $background ? (stripos($background, 'http') === 0 ? $background : config('site.cdnurl') . $background) : '';
|
||||
$request = Request::instance();
|
||||
if ($background == '' && !$request->isAjax() && !$request->isPost()) {
|
||||
$mode = 'random';
|
||||
$index = $mode == 'random' ? mt_rand(1, 4000) : date("Ymd") % 4000;
|
||||
$background = "http://img.infinitynewtab.com/wallpaper/" . $index . ".jpg";
|
||||
}
|
||||
$background = 'http://o2o.des8.com/web/uploads/20210828/f655feb4c0ba8e9f8ff0749674662951.jpg';
|
||||
$this->view->assign('background', $background);
|
||||
$this->view->assign('title', __('Login'));
|
||||
Hook::listen("admin_login_init", $this->request);
|
||||
|
@ -55,6 +55,18 @@ class Category extends Backend
|
||||
}
|
||||
$data = ['searchlist' => $searchlist];
|
||||
$this->success('', null, $data);
|
||||
}
|
||||
/**
|
||||
* 搜索下拉列表
|
||||
*/
|
||||
public function list()
|
||||
{
|
||||
$result = $this->model->limit(10)->select();
|
||||
$searchlist = [];
|
||||
foreach ($result as $key => $value) {
|
||||
$searchlist[] = ['value' => $value['id'], 'text' => $value['name']];
|
||||
}
|
||||
echo json_encode($searchlist);
|
||||
}
|
||||
public function del($ids = null)
|
||||
{
|
||||
|
@ -128,6 +128,7 @@ class Import extends Backend
|
||||
}
|
||||
foreach ($insert as $key => &$val) {
|
||||
//处理字段
|
||||
if($this->isCreditNo($val['cardid']) == true){
|
||||
$cardinfo = $this->checkcardid($val['cardid']);
|
||||
if ($cardinfo['iscard'] == false) {
|
||||
unset($insert[$key]);
|
||||
@ -135,12 +136,17 @@ class Import extends Backend
|
||||
$val['birthday'] = $cardinfo['birthday'];
|
||||
$val['genderdata'] = $cardinfo['sex'];
|
||||
}
|
||||
}else{
|
||||
$val['birthday'] = '0000-00-00';
|
||||
$val['genderdata'] = 'male';
|
||||
}
|
||||
if(!empty($val['frameno'])){
|
||||
$check_frameno = $this->check_frameno($val['frameno']);
|
||||
if($check_frameno == false){
|
||||
unset($insert[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
//todo:分组
|
||||
if(empty($val['category_id'])){
|
||||
$val['category_id'] = $this->all_cates[1];
|
||||
@ -158,7 +164,7 @@ class Import extends Backend
|
||||
}
|
||||
$val['level_id'] = $this->all_levels_name[$val['level_id']];
|
||||
}
|
||||
//var_dump($insert);
|
||||
|
||||
$prefix = Config::get('database.prefix');
|
||||
$count = 0;
|
||||
// if ($params['update']) {
|
||||
@ -330,6 +336,7 @@ class Import extends Backend
|
||||
if ($encoding != 'utf-8') {
|
||||
$line = mb_convert_encoding($line, 'utf-8', $encoding);
|
||||
}
|
||||
//var_dump($line);
|
||||
if ($n == 0 || preg_match('/^".*"$/', $line)) {
|
||||
fwrite($fp, $line . "\n");
|
||||
} else {
|
||||
@ -455,16 +462,22 @@ class Import extends Backend
|
||||
//var_dump($val);
|
||||
//todo:处理日期格式
|
||||
if($currentColumn == 8 || $currentColumn == 15){
|
||||
if($val==''){
|
||||
$val = '0000-00-00';
|
||||
}else{
|
||||
$val = date('Y-m-d',Date::excelToTimestamp($val));
|
||||
}
|
||||
}
|
||||
//todo:身份证校验
|
||||
if($currentColumn == 3){
|
||||
if($this->isCreditNo($val) == true){
|
||||
$cardinfo = $this->checkcardid($val);
|
||||
$check_cardid = $cardinfo['iscard'];
|
||||
if($check_cardid==false){
|
||||
$val=$val.'(身份证号错误)';
|
||||
}
|
||||
}
|
||||
}
|
||||
//todo:车牌重复检测
|
||||
if($currentColumn == 10 && strlen($val) > 3){
|
||||
$check_frameno = $this->check_frameno($val);
|
||||
@ -483,6 +496,7 @@ class Import extends Backend
|
||||
|
||||
$values[] = is_null($val) ? '' : $val;
|
||||
}
|
||||
//var_dump($values);
|
||||
//exit();
|
||||
$rows = [];
|
||||
$all = [];
|
||||
|
@ -4,6 +4,15 @@ namespace app\admin\controller\user4s;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Xls;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Csv;
|
||||
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Style;
|
||||
/**
|
||||
* 续保记录
|
||||
*
|
||||
@ -69,11 +78,114 @@ class Inslog extends Backend
|
||||
$item->createtime_f = date('Y-m-d',$item->createtime);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
$result = array("total" => $list->total(), "rows" => $list->items(), "extend" => ['start_data'=>date('Y-m-d',strtotime('-1 month')),'end_data'=>date('Y-m-d')]);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
/**
|
||||
* 对Spreadsheet方法封装(锐庆)
|
||||
* @param array $arr 该数组必须为键值对,键是表格单元,值是单元格的值
|
||||
* @param array $data 该数组如果为一维数组,则填写一行,如果为二维数组,则多行数据
|
||||
* @param string $name 下载Excel的文件名,可忽略
|
||||
* @param string $type 选择文件类型,如果不填写,默认下载为xlsx格式,如果任意填写数值为xls格式
|
||||
* @param int $with 设置sheet默认列宽
|
||||
*/
|
||||
public function downloadExcel(array $arr, array $data, $name = "", $type = "Xlsx")
|
||||
{
|
||||
//文件名处置
|
||||
if (empty($name)) {
|
||||
$name = date("Y-m-d H:i:s") . "_" . rand(1000, 9999);
|
||||
} else {
|
||||
$name = $name . "_" . date("Y-m-d H:i:s");
|
||||
}
|
||||
|
||||
//内容设置
|
||||
$preadsheet = new Spreadsheet();
|
||||
$sheet = $preadsheet->getActiveSheet();
|
||||
foreach ($arr as $k => $v) {
|
||||
$sheet->setCellValue($k, $v);
|
||||
}
|
||||
$sheet->fromArray($data, null, "A2");
|
||||
|
||||
//样式设置
|
||||
$sheet->getDefaultColumnDimension()->setWidth(20);
|
||||
|
||||
//设置下载与后缀
|
||||
if ($type == "Xlsx") {
|
||||
header("Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
$suffix = "xlsx";
|
||||
} else {
|
||||
header("Content-Type:application/vnd.ms-excel");
|
||||
$type = "Xls";
|
||||
$suffix = "xls";
|
||||
}
|
||||
header("Content-Disposition:attachment;filename=$name.$suffix");
|
||||
header("Cache-Control:max-age=0"); //缓存控制
|
||||
$writer = IOFactory::createWriter($preadsheet, $type);
|
||||
$writer->save("php://output"); //数据流
|
||||
}
|
||||
public function excel()
|
||||
{
|
||||
|
||||
set_time_limit(0);
|
||||
$all_star = array(
|
||||
1 => '★',
|
||||
2 => '★★',
|
||||
3 => '★★★',
|
||||
4 => '★★★★',
|
||||
5 => '★★★★★',
|
||||
);
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
$start_date = $this->request->get("start_date", '');
|
||||
$end_date = $this->request->get("end_date", '');
|
||||
if(empty($start_date) || empty($end_date)){
|
||||
$this->error('请选择要导出的日期范围');
|
||||
}
|
||||
$ins_where = array('inslog.insdate' => ['between', [date('Y-m-d', strtotime($start_date)), date('Y-m-d', strtotime($end_date))]]);
|
||||
$data = array();
|
||||
$head = array(
|
||||
'A1' => '编号',
|
||||
'B1' => '姓名',
|
||||
'C1' => '联系方式',
|
||||
'D1' => '身份证',
|
||||
'E1' => '生日',
|
||||
'F1' => '购车日期',
|
||||
'G1' => '车牌号码',
|
||||
'H1' => '车架号',
|
||||
'I1' => '车型',
|
||||
'J1' => '颜色',
|
||||
'K1' => '续保保险类型',
|
||||
'L1' => '续保保险公司',
|
||||
'M1' => '续保日期',
|
||||
'N1' => '满意度',
|
||||
'O1' => '备注',
|
||||
);
|
||||
$list = $this->model->with(['user'])->where($ins_where)->select();
|
||||
//var_dump($this->model->getLastSql());exit();
|
||||
$logs = collection($list)->toArray();
|
||||
foreach ($logs as $index => $item) {
|
||||
//var_dump($item);
|
||||
$data[] = array(
|
||||
$item['id'],
|
||||
$item['user']['name'],
|
||||
' '.$item['user']['tel'],
|
||||
' '.$item['user']['cardid'],
|
||||
date('Y年m月d日',strtotime($item['user']['birthday'])),
|
||||
date('Y年m月d日',strtotime($item['user']['buydate'])),
|
||||
$item['user']['carno'],
|
||||
$item['user']['frameno'],
|
||||
$item['user']['model'],
|
||||
$item['user']['color'],
|
||||
$item['instype'],
|
||||
$item['inscom'],
|
||||
date('Y年m月d日',strtotime($item['insdate'])),
|
||||
$all_star[$item['star']],
|
||||
$item['description'],
|
||||
);
|
||||
}
|
||||
return $this->downloadExcel($head,$data);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,10 @@ use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Xls;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Csv;
|
||||
use fast\Pinyin;
|
||||
use think\Loader;
|
||||
use think\Model;
|
||||
use car\Sms;
|
||||
use fast\Date;
|
||||
|
||||
/**
|
||||
* 用户档案
|
||||
@ -228,6 +232,7 @@ class User extends Backend
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
|
||||
$row->validateFailException(true)->validate($validate);
|
||||
}
|
||||
if(!empty($params['cardid'])){
|
||||
$cardinfo = $this->checkcardid($params['cardid']);
|
||||
if ($cardinfo['iscard'] == false) {
|
||||
$this->model->rollback();
|
||||
@ -236,12 +241,16 @@ class User extends Backend
|
||||
$params['birthday'] = $cardinfo['birthday'];
|
||||
$params['genderdata'] = $cardinfo['sex'];
|
||||
}
|
||||
$has_frameno = $this->model->get(['frameno', $params['frameno']]);
|
||||
if (!empty($has_frameno->id)) {
|
||||
$this->model->rollback();
|
||||
$this->error('车架号重复');
|
||||
}
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
// if(!empty($params['cardid'])){
|
||||
// $has_frameno = $this->model->get(['frameno', $params['frameno']]);
|
||||
// if (!empty($has_frameno->id)) {
|
||||
// $this->model->rollback();
|
||||
// $this->error('车架号重复');
|
||||
// }
|
||||
// }
|
||||
|
||||
// $result = $this->model->allowField(true)->save($params);
|
||||
$result = $row->allowField(true)->save($params);
|
||||
$this->model->commit();
|
||||
} catch (ValidateException $e) {
|
||||
@ -294,50 +303,7 @@ class User extends Backend
|
||||
}
|
||||
$this->error('车架号重复');
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
// public function del($ids = "")
|
||||
// {
|
||||
// if (!$this->request->isPost()) {
|
||||
// $this->error(__("Invalid parameters"));
|
||||
// }
|
||||
// $ids = $ids ? $ids : $this->request->post("ids");
|
||||
// if ($ids) {
|
||||
// if($ids == 1 || in_array('1',$ids)){
|
||||
// $this->error(__('默认等级(ID:1)禁止删除,请重新操作!'));
|
||||
// }
|
||||
// $pk = $this->model->getPk();
|
||||
// $adminIds = $this->getDataLimitAdminIds();
|
||||
// if (is_array($adminIds)) {
|
||||
// $this->model->where($this->dataLimitField, 'in', $adminIds);
|
||||
// }
|
||||
// $list = $this->model->where($pk, 'in', $ids)->select();
|
||||
|
||||
// $count = 0;
|
||||
// $this->model->startTrans();
|
||||
// try {
|
||||
// foreach ($list as $k => $v) {
|
||||
// $count += $v->delete();
|
||||
// //删除用户记录
|
||||
// //$log_res = $this->model->afterlog($this->auth->id,$this->model,$v->id,'',false);
|
||||
// }
|
||||
// $this->model->commit();
|
||||
// } catch (PDOException $e) {
|
||||
// $this->model->rollback();
|
||||
// $this->error($e->getMessage());
|
||||
// } catch (Exception $e) {
|
||||
// $this->model->rollback();
|
||||
// $this->error($e->getMessage());
|
||||
// }
|
||||
// if ($count) {
|
||||
// $this->success();
|
||||
// } else {
|
||||
// $this->error(__('No rows were deleted'));
|
||||
// }
|
||||
// }
|
||||
// $this->error(__('Parameter %s can not be empty', 'ids'));
|
||||
// }
|
||||
/**
|
||||
* 充值
|
||||
*/
|
||||
@ -433,36 +399,65 @@ class User extends Backend
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
|
||||
$start_date = strtotime("-1 year");
|
||||
$end_date = strtotime("+2 month", $start_date);
|
||||
$ins_where = array(
|
||||
'insdate' => ['between', [date('Y-m-d', $start_date), date('Y-m-d', $end_date)]]
|
||||
);
|
||||
$ins_where = array();
|
||||
$start = strtotime("-1 year");
|
||||
$end = strtotime("+2 month", $start);
|
||||
|
||||
$start_date = $this->request->get("start_date", '');
|
||||
$end_date = $this->request->get("end_date", '');
|
||||
|
||||
if(!empty($start_date) && !empty($end_date)){
|
||||
$start = strtotime(date('Y-').$start_date);
|
||||
$end = strtotime(date('Y-').$end_date);
|
||||
|
||||
for ($y=1; $y<=30; $y++) {
|
||||
$start_dates = strtotime("-".$y." year",$start);
|
||||
$end_dates = strtotime("-".$y." year", $end);
|
||||
$ins_where[] = array('insdate' => ['between', [date('Y-m-d', $start_dates), date('Y-m-d', $end_dates)]]);
|
||||
}
|
||||
}
|
||||
if ($this->request->isAjax()) {
|
||||
// $start_date = $this->request->post("start_date", '');
|
||||
// $end_date = $this->request->post("end_date", '');
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$list = $this->model
|
||||
->with(['category', 'level'])
|
||||
->where($where)
|
||||
->where(function ($query) {
|
||||
for ($y=1; $y<=20; $y++) {
|
||||
$start_date = strtotime("-".$y." year");
|
||||
$end_date = strtotime("+2 month", $start_date);
|
||||
->where(function ($query) use($ins_where) {
|
||||
//todo:测试闭包传递参数
|
||||
if(!empty($ins_where)){
|
||||
foreach($ins_where as $item){
|
||||
$query->whereOr($item);
|
||||
}
|
||||
}else{
|
||||
for ($y=1; $y<=30; $y++) {
|
||||
$start = strtotime("-".$y." year");
|
||||
$end = strtotime("+2 month", $start);
|
||||
$ins_where = array(
|
||||
'insdate' => ['between', [date('Y-m-d', $start_date), date('Y-m-d', $end_date)]]
|
||||
'insdate' => ['between', [date('Y-m-d', $start), date('Y-m-d', $end)]]
|
||||
);
|
||||
$query->whereOr($ins_where);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
//var_dump($this->model->getLastSql());
|
||||
foreach ($list as $row) {
|
||||
|
||||
foreach ($list as &$row) {
|
||||
$row->getRelation('category')->visible(['name']);
|
||||
$row->getRelation('level')->visible(['name']);
|
||||
$tip_start = Date::unixtime('year', 0,'start');
|
||||
$tip_end = Date::unixtime('year', 0,'end');
|
||||
//var_dump($tip_start,$tip_end);
|
||||
if($row->instiptime >=$tip_start && $row->instiptime <=$tip_end){
|
||||
$row->instip = 1;
|
||||
}else{
|
||||
$row->instip = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items(), "extend" => ['start_date' => date('m-d', $start_date), 'end_date' => date('m-d', $end_date)]);
|
||||
$result = array("total" => $list->total(), "rows" => $list->items(), "extend" => ['start_date' => date('m-d', $start), 'end_date' => date('m-d', $end)],'sql'=>$this->model->getLastSql());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
@ -528,7 +523,60 @@ class User extends Backend
|
||||
$this->view->assign('row', $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
/**
|
||||
* 续保提醒
|
||||
*/
|
||||
public function instip($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
}
|
||||
//$all_level = $this->level_model->where('status', 1)->column('id,name');
|
||||
|
||||
if ($this->request->isPost()) {
|
||||
//记录用户续保提醒
|
||||
$row->instiptime = time();
|
||||
$row->save();
|
||||
$this->success('记录提醒状态成功!', url('user4s/user/expireins'),array('tiptime'=>date('Y-m-d H:i:s')));
|
||||
}
|
||||
$this->view->assign('row', $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
/**
|
||||
* 取消续保提醒
|
||||
*/
|
||||
public function instipno($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
}
|
||||
//$all_level = $this->level_model->where('status', 1)->column('id,name');
|
||||
|
||||
if ($this->request->isPost()) {
|
||||
//记录用户续保提醒
|
||||
$row->instiptime = 0;
|
||||
$row->save();
|
||||
$this->success('取消提醒状态成功', url('user4s/user/expireins'),array('tiptime'=>date('Y-m-d H:i:s')));
|
||||
}
|
||||
$this->view->assign('row', $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
/**
|
||||
* 过生日用户列表
|
||||
*/
|
||||
@ -540,9 +588,29 @@ class User extends Backend
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
|
||||
if ($this->request->isAjax()) {
|
||||
$birthday_users = Db::query("select id from car_user4s_user where MONTH(birthday) = MONTH(NOW()) and DAY(birthday) = DAY(NOW())");
|
||||
|
||||
$birthday = $this->request->get("birthday", '');
|
||||
if(!empty($birthday)){
|
||||
//halt($birthday);
|
||||
$search_date = '2022-'.$birthday;
|
||||
}else{
|
||||
$filter = $this->request->get("filter", '');
|
||||
$op = $this->request->get("op", '', 'trim');
|
||||
$filter = (array)json_decode($filter, true);
|
||||
$op = (array)json_decode($op, true);
|
||||
if(!empty($filter['birthday'])){
|
||||
$search_date = '2022-'.$filter['birthday'];
|
||||
$_GET['filter']= '{}';
|
||||
$_GET['op']= '{}';
|
||||
}else{
|
||||
$search_date = date('Y-m-d');
|
||||
}
|
||||
}
|
||||
|
||||
$birthday_users = Db::query("select id from car_user4s_user where MONTH(birthday) = MONTH('".$search_date."') and DAY(birthday) = DAY('".$search_date."')");
|
||||
|
||||
if(empty($birthday_users)){
|
||||
$result = array("total" => 0, "rows" => [], "extend" => ['start_date' => date('m-d')]);
|
||||
$result = array("total" => 0, "rows" => [], "extend" => ['start_date' => date('m-d',strtotime($search_date))]);
|
||||
return json($result);
|
||||
}else{
|
||||
foreach ($birthday_users as $key => $value) {
|
||||
@ -550,27 +618,262 @@ class User extends Backend
|
||||
}
|
||||
}
|
||||
if(empty($birthday_user_ids)){
|
||||
$result = array("total" => 0, "rows" => [], "extend" => ['start_date' => date('m-d')]);
|
||||
$result = array("total" => 0, "rows" => [], "extend" => ['start_date' => date('m-d',strtotime($search_date))]);
|
||||
return json($result);
|
||||
}
|
||||
|
||||
//var_dump($filter,$op);
|
||||
//var_dump($birthday_user_ids);
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparamsu('{}','{}');
|
||||
$list = $this->model
|
||||
->with(['category', 'level'])
|
||||
->where($where)
|
||||
->where('user.id', 'in', $birthday_user_ids)
|
||||
->where('user.birthday', '<>', '0000-00-00')
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
//var_dump($this->model->getLastSql());
|
||||
//echo($this->model->getLastSql());
|
||||
foreach ($list as $row) {
|
||||
$row->getRelation('category')->visible(['name']);
|
||||
$row->getRelation('level')->visible(['name']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items(), "extend" => ['start_date' => date('m-d')]);
|
||||
$result = array("total" => $list->total(), "rows" => $list->items(), "extend" => ['start_date' => date('m-d',strtotime($search_date))]);
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
protected function buildparamsu($filter,$op,$searchfields = null, $relationSearch = null)
|
||||
{
|
||||
$searchfields = is_null($searchfields) ? $this->searchFields : $searchfields;
|
||||
$relationSearch = is_null($relationSearch) ? $this->relationSearch : $relationSearch;
|
||||
$search = $this->request->get("search", '');
|
||||
// $filter = $this->request->get("filter", '');
|
||||
// $op = $this->request->get("op", '', 'trim');
|
||||
$sort = $this->request->get("sort", !empty($this->model) && $this->model->getPk() ? $this->model->getPk() : 'id');
|
||||
$order = $this->request->get("order", "DESC");
|
||||
$offset = $this->request->get("offset/d", 0);
|
||||
$limit = $this->request->get("limit/d", 999999);
|
||||
//新增自动计算页码
|
||||
$page = $limit ? intval($offset / $limit) + 1 : 1;
|
||||
if ($this->request->has("page")) {
|
||||
$page = $this->request->get("page/d", 1);
|
||||
}
|
||||
$this->request->get([config('paginate.var_page') => $page]);
|
||||
$filter = (array)json_decode($filter, true);
|
||||
$op = (array)json_decode($op, true);
|
||||
$filter = $filter ? $filter : [];
|
||||
$where = [];
|
||||
$alias = [];
|
||||
$bind = [];
|
||||
$name = '';
|
||||
$aliasName = '';
|
||||
if (!empty($this->model) && $this->relationSearch) {
|
||||
$name = $this->model->getTable();
|
||||
$alias[$name] = Loader::parseName(basename(str_replace('\\', '/', get_class($this->model))));
|
||||
$aliasName = $alias[$name] . '.';
|
||||
}
|
||||
$sortArr = explode(',', $sort);
|
||||
foreach ($sortArr as $index => & $item) {
|
||||
$item = stripos($item, ".") === false ? $aliasName . trim($item) : $item;
|
||||
}
|
||||
unset($item);
|
||||
$sort = implode(',', $sortArr);
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
$where[] = [$aliasName . $this->dataLimitField, 'in', $adminIds];
|
||||
}
|
||||
if ($search) {
|
||||
$searcharr = is_array($searchfields) ? $searchfields : explode(',', $searchfields);
|
||||
foreach ($searcharr as $k => &$v) {
|
||||
$v = stripos($v, ".") === false ? $aliasName . $v : $v;
|
||||
}
|
||||
unset($v);
|
||||
$where[] = [implode("|", $searcharr), "LIKE", "%{$search}%"];
|
||||
}
|
||||
$index = 0;
|
||||
foreach ($filter as $k => $v) {
|
||||
if (!preg_match('/^[a-zA-Z0-9_\-\.]+$/', $k)) {
|
||||
continue;
|
||||
}
|
||||
$sym = isset($op[$k]) ? $op[$k] : '=';
|
||||
if (stripos($k, ".") === false) {
|
||||
$k = $aliasName . $k;
|
||||
}
|
||||
$v = !is_array($v) ? trim($v) : $v;
|
||||
$sym = strtoupper(isset($op[$k]) ? $op[$k] : $sym);
|
||||
//null和空字符串特殊处理
|
||||
if (!is_array($v)) {
|
||||
if (in_array(strtoupper($v), ['NULL', 'NOT NULL'])) {
|
||||
$sym = strtoupper($v);
|
||||
}
|
||||
if (in_array($v, ['""', "''"])) {
|
||||
$v = '';
|
||||
$sym = '=';
|
||||
}
|
||||
}
|
||||
|
||||
switch ($sym) {
|
||||
case '=':
|
||||
case '<>':
|
||||
$where[] = [$k, $sym, (string)$v];
|
||||
break;
|
||||
case 'LIKE':
|
||||
case 'NOT LIKE':
|
||||
case 'LIKE %...%':
|
||||
case 'NOT LIKE %...%':
|
||||
$where[] = [$k, trim(str_replace('%...%', '', $sym)), "%{$v}%"];
|
||||
break;
|
||||
case '>':
|
||||
case '>=':
|
||||
case '<':
|
||||
case '<=':
|
||||
$where[] = [$k, $sym, intval($v)];
|
||||
break;
|
||||
case 'FINDIN':
|
||||
case 'FINDINSET':
|
||||
case 'FIND_IN_SET':
|
||||
$v = is_array($v) ? $v : explode(',', str_replace(' ', ',', $v));
|
||||
$findArr = array_values($v);
|
||||
foreach ($findArr as $idx => $item) {
|
||||
$bindName = "item_" . $index . "_" . $idx;
|
||||
$bind[$bindName] = $item;
|
||||
$where[] = "FIND_IN_SET(:{$bindName}, `" . str_replace('.', '`.`', $k) . "`)";
|
||||
}
|
||||
break;
|
||||
case 'IN':
|
||||
case 'IN(...)':
|
||||
case 'NOT IN':
|
||||
case 'NOT IN(...)':
|
||||
$where[] = [$k, str_replace('(...)', '', $sym), is_array($v) ? $v : explode(',', $v)];
|
||||
break;
|
||||
case 'BETWEEN':
|
||||
case 'NOT BETWEEN':
|
||||
$arr = array_slice(explode(',', $v), 0, 2);
|
||||
if (stripos($v, ',') === false || !array_filter($arr, function($v){
|
||||
return $v != '' && $v !== false && $v !== null;
|
||||
})) {
|
||||
continue 2;
|
||||
}
|
||||
//当出现一边为空时改变操作符
|
||||
if ($arr[0] === '') {
|
||||
$sym = $sym == 'BETWEEN' ? '<=' : '>';
|
||||
$arr = $arr[1];
|
||||
} elseif ($arr[1] === '') {
|
||||
$sym = $sym == 'BETWEEN' ? '>=' : '<';
|
||||
$arr = $arr[0];
|
||||
}
|
||||
$where[] = [$k, $sym, $arr];
|
||||
break;
|
||||
case 'RANGE':
|
||||
case 'NOT RANGE':
|
||||
$v = str_replace(' - ', ',', $v);
|
||||
$arr = array_slice(explode(',', $v), 0, 2);
|
||||
if (stripos($v, ',') === false || !array_filter($arr)) {
|
||||
continue 2;
|
||||
}
|
||||
//当出现一边为空时改变操作符
|
||||
if ($arr[0] === '') {
|
||||
$sym = $sym == 'RANGE' ? '<=' : '>';
|
||||
$arr = $arr[1];
|
||||
} elseif ($arr[1] === '') {
|
||||
$sym = $sym == 'RANGE' ? '>=' : '<';
|
||||
$arr = $arr[0];
|
||||
}
|
||||
$tableArr = explode('.', $k);
|
||||
if (count($tableArr) > 1 && $tableArr[0] != $name && !in_array($tableArr[0], $alias) && !empty($this->model)) {
|
||||
//修复关联模型下时间无法搜索的BUG
|
||||
$relation = Loader::parseName($tableArr[0], 1, false);
|
||||
$alias[$this->model->$relation()->getTable()] = $tableArr[0];
|
||||
}
|
||||
$where[] = [$k, str_replace('RANGE', 'BETWEEN', $sym) . ' TIME', $arr];
|
||||
break;
|
||||
case 'NULL':
|
||||
case 'IS NULL':
|
||||
case 'NOT NULL':
|
||||
case 'IS NOT NULL':
|
||||
$where[] = [$k, strtolower(str_replace('IS ', '', $sym))];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
if (!empty($this->model)) {
|
||||
$this->model->alias($alias);
|
||||
}
|
||||
$model = $this->model;
|
||||
$where = function ($query) use ($where, $alias, $bind, &$model) {
|
||||
if (!empty($model)) {
|
||||
$model->alias($alias);
|
||||
$model->bind($bind);
|
||||
}
|
||||
foreach ($where as $k => $v) {
|
||||
if (is_array($v)) {
|
||||
call_user_func_array([$query, 'where'], $v);
|
||||
} else {
|
||||
$query->where($v);
|
||||
}
|
||||
}
|
||||
};
|
||||
return [$where, $sort, $order, $offset, $limit, $page, $alias, $bind];
|
||||
}
|
||||
|
||||
/**
|
||||
* sms
|
||||
*/
|
||||
public function sms($ids = null)
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$this->token();
|
||||
}
|
||||
if(stripos($ids, ',') >= 1){
|
||||
$ids = explode(',',$ids);
|
||||
}else{
|
||||
$ids = array($ids);
|
||||
}
|
||||
$row = $this->model->where('id','in',$ids)->select();
|
||||
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
}
|
||||
|
||||
//短信info
|
||||
$sms_config = array(
|
||||
'userid' => Config::get('site.sms_userid'),
|
||||
'account' => Config::get('site.sms_user'),
|
||||
'password' => Config::get('site.sms_passwd'),
|
||||
);
|
||||
$sms = new Sms($sms_config);
|
||||
$sms_info = $sms->getOverage();
|
||||
if(!$sms_info['status']){
|
||||
$this->error('短信平台配置错误,请检查配置!'.$sms_info['message']);
|
||||
}
|
||||
$this->view->assign("sms_info", $sms_info);
|
||||
if ($this->request->isPost()) {
|
||||
$content = $this->request->post("sms_content");
|
||||
if ($content && is_array($ids)) {
|
||||
//var_dump($ids);
|
||||
//halt($content);
|
||||
$send_status = $sms->send($ids,$content);
|
||||
if($send_status['code'] == 0){
|
||||
$this->error(__('发送失败!错误提示:'.$send_status['msg'], ''),'',$send_status);
|
||||
}else{
|
||||
$this->success('发送成功!共计:'.$send_status['total'].'个,发送成功:'.$send_status['success'].'个','',$send_status);
|
||||
}
|
||||
//var_dump($send_status);
|
||||
}
|
||||
$this->error(__('短信内容为空', ''));
|
||||
}
|
||||
$this->view->assign("row", collection($row)->toarray());
|
||||
$this->view->assign("user_num", count($row));
|
||||
return $this->view->fetch();
|
||||
}
|
||||
}
|
||||
|
@ -211,6 +211,7 @@ class Visitlog extends Backend
|
||||
);
|
||||
//var_dump($visit_data);exit();
|
||||
$this->visit_model->where('id', $params['visit_id'])->update($visit_data);
|
||||
//$result = $row->allowField(true)->save($params);
|
||||
}
|
||||
unset($params['is_end']);
|
||||
//var_dump($params);exit();
|
||||
|
@ -12,6 +12,38 @@
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('user4s/inslog/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
|
||||
|
||||
<div class="form-group" style="position: unset;position: unset;display: inline-block;
|
||||
margin-bottom: 0;
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
touch-action: manipulation;
|
||||
width: 240px;">
|
||||
|
||||
|
||||
|
||||
<!-- <label for="insdate" class="control-label col-xs-4">保险日期</label> -->
|
||||
<div class="col-xs-12" style="padding-left: 0px;">
|
||||
|
||||
<div class="row row-between">
|
||||
<div class="col-xs-6" style="position: relative;padding-left: 15px;padding-right: 5px;">
|
||||
<input type="text" class="form-control datetimepicker" name="insdate" value="" placeholder="保险日期" id="start_date" data-index="10" data-date-format="YYYY-MM-DD" ,data-date-use-current="true" autocomplete="off">
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6" style="position: relative;padding-right: 5px;padding-left: 5px;">
|
||||
<input type="text" class="form-control datetimepicker" name="insdate" value="" placeholder="保险日期" id="end_date" data-index="10" data-date-format="YYYY-MM-DD" ,data-date-use-current="true" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <a href="javascript:;" class="btn btn-default" style="font-size:14px;color:dodgerblue;">
|
||||
<i class="fa fa-calendar"></i>
|
||||
<span class="extend">
|
||||
统计时间:
|
||||
</span>
|
||||
</a> -->
|
||||
<a href="javascript:;" class="btn btn-primary btn-excel" style="font-size:14px;"><i class="fa fa-cog"></i> {:__('导出')}</a>
|
||||
|
||||
<!-- <div class="dropdown btn-group {:$auth->check('user4s/inslog/multi')?'':'hide'}">
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
|
||||
<ul class="dropdown-menu text-left" role="menu">
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div class="panel-heading">
|
||||
{:build_heading(null,FALSE)}
|
||||
<div class="panel-lead"><em>生日提醒</em>今日过生日的客户。</div>
|
||||
<!-- <div class="panel-lead"><em>生日提醒</em>今日过生日的客户。</div> -->
|
||||
</div>
|
||||
|
||||
|
||||
@ -12,12 +12,75 @@
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||
<a href="javascript:;" class="btn btn-default" style="font-size:14px;color:dodgerblue;">
|
||||
|
||||
<!-- <div id="customformtpl" style="float: right;">
|
||||
<form action="" class="form-commonsearch form-horizontal nice-validator n-default n-bootstrap" novalidate="novalidate">
|
||||
<div style="/* margin-bottom:10px; */background:#ffffff;/* padding:5px 5px; */">
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-6">生日查询:</label>
|
||||
<input type="hidden" class="operate" data-name="birthday" value="=" id="N149023577339">
|
||||
<div class="col-xs-12 col-sm-6" style="position: relative;">
|
||||
<input id="c-birthday" class="form-control datetimepicker" data-date-format="MM-DD" data-use-current="true" name="birthday" type="text" value="07-03">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<div class="form-group">
|
||||
<div class="col-xs-4">
|
||||
<input type="submit" class="btn btn-success btn-block" value="提交">
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<input type="reset" class="btn btn-primary btn-block" value="重置">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div> -->
|
||||
<div class="input-group date" id="datetimepicker1" style="display: -webkit-inline-box;
|
||||
margin-bottom: 0;
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
touch-action: manipulation;
|
||||
cursor: pointer;
|
||||
background-image: none;
|
||||
border: 1px solid transparent;
|
||||
white-space: nowrap;
|
||||
padding: 6px 12px;
|
||||
font-size: 13px;
|
||||
line-height: 1.42857143;
|
||||
border-radius: 3px;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;">
|
||||
<span class="input-group-addon" style="font-size:14px;color:dodgerblue;width: auto;">
|
||||
<i class="fa fa-calendar"></i>
|
||||
<span class="extend">
|
||||
查询生日
|
||||
</span>
|
||||
</span>
|
||||
<input id="m-birthday" class="form-control" data-date-format="MM-DD" data-use-current="true" name="birthday" type="text" value="{:date('m-d')}" style="display: block;width: 60px;float: right;">
|
||||
</div>
|
||||
|
||||
<!-- <input id="m-birthday" class="form-control" data-date-format="MM-DD" data-use-current="true" name="birthday" type="text" value="07-03" style="display: block;width: 80px;float: right;margin-left: 0.2em;"> -->
|
||||
|
||||
|
||||
<a href="javascript:;" class="btn btn-default" style="font-size:14px;color:dodgerblue;display: none;">
|
||||
<i class="fa fa-calendar"></i>
|
||||
<span class="extend">
|
||||
生日:<span id="start_date"></span>
|
||||
</span>
|
||||
</a>
|
||||
<a href="javascript:;" class="btn btn-warning btn-sms btn-disabled disabled {:$auth->check('user4s/user/sms')?'':'hide'}" title="{:__('发送短信')}" data-area=["80%","80%"]><i class="fa fa-commenting-o"></i> {:__('发送短信')}</a>
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('user4s/user/edit')}"
|
||||
@ -30,3 +93,34 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script id="customformtpl" type="text/html">
|
||||
<form action="" class="form-commonsearch form-horizontal">
|
||||
<div style="background:#ffffff;padding:5px 5px 0px 0px;">
|
||||
<div class="row">
|
||||
<div class="col-xs-4 col-sm-3 col-md-2">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-4" style="line-height: 20px;">{:__('生日查询')}:</label>
|
||||
<input type="hidden" class="operate" data-name="birthday" value="="/>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-birthday" data-rule="required" class="form-control datetimepicker" data-date-format="MM-DD" data-use-current="true" name="birthday" type="text" value="{:date('m-d')}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-sm-3 col-md-2">
|
||||
<div class="form-group">
|
||||
<div class="col-xs-4">
|
||||
<input type="submit" class="btn btn-success btn-block" value="提交"/>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<!-- <input type="reset" class="btn btn-primary btn-block" value="重置"/> -->
|
||||
</div>
|
||||
<div class="col-xs-4"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</script>
|
@ -23,13 +23,13 @@
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Carno')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-carno" data-rule="required" class="form-control" name="row[carno]" type="text" value="{$row.carno|htmlentities}">
|
||||
<input id="c-carno" class="form-control" name="row[carno]" type="text" value="{$row.carno|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('车架号')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-frameno" data-rule="required;remote(user4s/user/check_frameno)" class="form-control" name="row[frameno]" type="text" value="{$row.frameno|htmlentities}">
|
||||
<input id="c-frameno" data-rule="required" class="form-control" name="row[frameno]" type="text" value="{$row.frameno|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-category_id" data-rule="required" data-source="user4s/category/selectpage" data-params='{"custom[type]":"user4s_user"}' class="form-control selectpage" name="row[category_id]" type="text" value="{$row.category_id|htmlentities}">
|
||||
<input id="c-category_id" data-rule="required" data-source="user4s/category/selectpage" class="form-control selectpage" name="row[category_id]" type="text" value="{$row.category_id|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -63,19 +63,19 @@
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('保险类型')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-instype" data-rule="required" class="form-control" name="row[instype]" type="text" value="{$row.instype|htmlentities}">
|
||||
<input id="c-instype" class="form-control" name="row[instype]" type="text" value="{$row.instype|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('保险公司')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-inscom" data-rule="required" class="form-control" name="row[inscom]" type="text" value="{$row.inscom|htmlentities}">
|
||||
<input id="c-inscom" class="form-control" name="row[inscom]" type="text" value="{$row.inscom|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Insdate')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-insdate" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[insdate]" type="text" value="{$row.insdate}">
|
||||
<input id="c-insdate" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[insdate]" type="text" value="{if $row.insdate=='0000-00-00'}{$row.buydate}{else}{$row.insdate}{/if}">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group">
|
||||
|
@ -12,13 +12,51 @@
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||
|
||||
<a href="javascript:;" class="btn btn-default" style="font-size:14px;color:dodgerblue;">
|
||||
<i class="fa fa-calendar"></i>
|
||||
<span class="extend">
|
||||
统计时间:
|
||||
</span>
|
||||
</a>
|
||||
<div class="form-group" style="position: unset;position: unset;display: inline-block;
|
||||
margin-bottom: 0;
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
touch-action: manipulation;
|
||||
width: 200px;">
|
||||
|
||||
|
||||
|
||||
<!-- <label for="insdate" class="control-label col-xs-4">保险日期</label> -->
|
||||
<div class="col-xs-12" style="padding-left: 0px;">
|
||||
|
||||
<div class="row row-between">
|
||||
<div class="col-xs-6" style="position: relative;padding-left: 15px;padding-right: 5px;">
|
||||
<input type="text" class="form-control datetimepicker" name="insdate" value="" placeholder="保险日期" id="start_date" data-index="10" data-date-format="MM-DD" ,data-date-use-current="true" autocomplete="off">
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6" style="position: relative;padding-right: 5px;padding-left: 5px;">
|
||||
<input type="text" class="form-control datetimepicker" name="insdate" value="" placeholder="保险日期" id="end_date" data-index="10" data-date-format="MM-DD" ,data-date-use-current="true" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <a href="javascript:;" class="btn btn-default" style="font-size:14px;color:dodgerblue;">
|
||||
<i class="fa fa-calendar"></i>
|
||||
<span class="extend">
|
||||
统计时间:<span id="start_date"></span>
|
||||
至 <span id="end_date"></span>
|
||||
</span>
|
||||
</a>
|
||||
</a> -->
|
||||
<a href="javascript:;" class="btn btn-warning btn-sms btn-disabled disabled {:$auth->check('user4s/user/sms')?'':'hide'}" title="{:__('发送短信')}" data-area=["80%","80%"]><i class="fa fa-commenting-o"></i> {:__('发送短信')}</a>
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('user4s/user/edit')}"
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
<a href="user4s/import/index" class="btn btn-info btn-excel btn-dialog {:$auth->check('user4s/user/excel')?'':'hide'}" title="{:__('Excel导入')}" data-area=["80%","90%"]><i class="fa fa-file-excel-o"></i> {:__('Excel导入')}</a>
|
||||
|
||||
<a href="javascript:;" class="btn btn-warning btn-sms btn-disabled disabled {:$auth->check('user4s/user/sms')?'':'hide'}" title="{:__('发送短信')}" data-area=["80%","80%"]><i class="fa fa-commenting-o"></i> {:__('发送短信')}</a>
|
||||
|
||||
<!-- <div class="dropdown btn-group {:$auth->check('user4s/user/multi')?'':'hide'}">
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
|
||||
<ul class="dropdown-menu text-left" role="menu">
|
||||
|
142
application/admin/view/user4s/user/sms.html
Normal file
142
application/admin/view/user4s/user/sms.html
Normal file
@ -0,0 +1,142 @@
|
||||
<form id="sms-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
{:token()}
|
||||
<div class="panel panel-warning">
|
||||
<div class="panel-heading"><b>用户和平台信息</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-4 col-sm-2">用户数:</label>
|
||||
<div class="col-xs-6 col-sm-8">
|
||||
<label class="control-label">{$user_num|htmlentities}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-4 col-sm-2">姓名电话:</label>
|
||||
<div class="col-xs-6 col-sm-8">
|
||||
<label class="control-label" style="text-align: left;">
|
||||
{foreach $row as $vo}
|
||||
<span class="label label-info" id="status_{$vo['id']}">{$vo['name']}({$vo['tel']})</span>
|
||||
{/foreach}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-4 col-sm-2">发送状态:</label>
|
||||
<div class="col-xs-8 col-sm-10">
|
||||
<label class="control-label" style="text-align: left;" id="sms_status">
|
||||
未发送
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-4 col-sm-2">短信余额:</label>
|
||||
<div class="col-xs-6 col-sm-8">
|
||||
<label class="control-label">{$sms_info.overage|htmlentities}元</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-4 col-sm-2">短信总点数:</label>
|
||||
<div class="col-xs-6 col-sm-8">
|
||||
<label class="control-label">{$sms_info.sendTotal|htmlentities}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('短信内容')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<textarea name="sms_content" class="form-control" data-rule="" rows="5" >【比亚迪汽车】亲爱的[姓氏][称呼],祝您生日快乐,平安健康,美好常伴。退订回T</textarea>
|
||||
<span id="helpBlock" class="help-block">短信内容需要以“【公司名称】”开头,以“退订回T”结尾,支持环境变量。</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('环境变量示例')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<label class="control-label" style="text-align: left;">
|
||||
|
||||
<span class="label label-primary">[ID] 示例值:1</span>
|
||||
<span class="label label-primary">[姓名] 示例值:张三</span>
|
||||
<span class="label label-primary">[姓氏] 示例值:张</span>
|
||||
<span class="label label-primary">[联系方式] 示例值:1526425507</span>
|
||||
<span class="label label-primary">[余额] 示例值:1.00</span>
|
||||
<span class="label label-primary">[积分] 示例值:100</span>
|
||||
<span class="label label-primary">[性别] 示例值:男 女</span>
|
||||
<span class="label label-primary">[称呼] 示例值:先生 女士</span>
|
||||
<span class="label label-primary">[身份证] 示例值:3713261xxxxxxxxx</span>
|
||||
<span class="label label-primary">[生日] 示例值:2022-05-08</span>
|
||||
<span class="label label-primary">[购车日期] 示例值:2022-05-08</span>
|
||||
<span class="label label-primary">[车牌号码] 示例值:鲁Q12345</span>
|
||||
<span class="label label-primary">[车架号] 示例值:LGXC14DF6L0127066</span>
|
||||
<span class="label label-primary">[车型] 示例值:宋经典手动</span>
|
||||
<span class="label label-primary">[颜色] 示例值:水晶白</span>
|
||||
<span class="label label-primary">[保险类型] 示例值:交强险</span>
|
||||
<span class="label label-primary">[保险公司] 示例值:平安保险 人保</span>
|
||||
<span class="label label-primary">[保险日期] 示例值:2022-05-08</span>
|
||||
<span class="label label-primary">[备注]</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed">{:__('发送')}</button>
|
||||
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<style>
|
||||
.bs-callout {
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
border: 1px solid #eee;
|
||||
border-left-width: 5px;
|
||||
border-radius: 3px;
|
||||
|
||||
h4 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
code {
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
+.bs-callout {
|
||||
margin-top: -5px;
|
||||
}
|
||||
}
|
||||
|
||||
.bs-callout-danger {
|
||||
border-left-color: #ce4844;
|
||||
|
||||
h4 {
|
||||
color: #ce4844;
|
||||
}
|
||||
}
|
||||
|
||||
.bs-callout-warning {
|
||||
border-left-color: #aa6708;
|
||||
|
||||
h4 {
|
||||
color: #aa6708;
|
||||
}
|
||||
}
|
||||
|
||||
.bs-callout-info {
|
||||
border-left-color: #1b809e;
|
||||
|
||||
h4 {
|
||||
color: #1b809e;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -18,9 +18,9 @@
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||
<a href="javascript:;" class="btn btn-success btn-add2 {:$auth->check('user4s/visit/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('开单')}</a>
|
||||
<!-- <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('user4s/visit/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> -->
|
||||
<!-- <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('user4s/visit/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> -->
|
||||
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('user4s/visit/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
|
||||
<a href="javascript:;" class="btn btn-warning btn-sms btn-disabled disabled {:$auth->check('user4s/user/sms')?'':'hide'}" title="{:__('发送短信')}" data-area=["80%","80%"]><i class="fa fa-commenting-o"></i> {:__('发送短信')}</a>
|
||||
<!-- <div class="dropdown btn-group {:$auth->check('user4s/visit/multi')?'':'hide'}">
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
|
||||
<ul class="dropdown-menu text-left" role="menu">
|
||||
|
@ -55,7 +55,7 @@
|
||||
<!-- <input id="c-star" min="0" class="form-control" name="row[star]" type="number" value="0"> -->
|
||||
<select id="c-star" data-rule="required" class="form-control selectpicker" name="row[star]">
|
||||
{foreach name="all_star" item="vo"}
|
||||
<option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
|
||||
<option value="{$key}" {in name="key" value="5"}selected{/in}>{$vo}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Tip_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-tip_time" data-rule="required" class="form-control" name="row[tip_time]" type="text" value="{:$row.tip_time|intval}">
|
||||
<input id="c-tip_time" data-rule="required" class="form-control" name="row[tip_time]" type="text" value="{$row.tip_time|intval}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\controller;
|
||||
|
||||
use app\admin\library\Auth;
|
||||
use think\Config;
|
||||
use think\Controller;
|
||||
@ -12,53 +10,44 @@ use think\Model;
|
||||
use think\Session;
|
||||
use fast\Tree;
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 后台控制器基类
|
||||
*/
|
||||
class Backend extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 无需登录的方法,同时也就不需要鉴权了
|
||||
* @var array
|
||||
*/
|
||||
protected $noNeedLogin = [];
|
||||
|
||||
/**
|
||||
* 无需鉴权的方法,但需要登录
|
||||
* @var array
|
||||
*/
|
||||
protected $noNeedRight = [];
|
||||
|
||||
/**
|
||||
* 布局模板
|
||||
* @var string
|
||||
*/
|
||||
protected $layout = 'default';
|
||||
|
||||
/**
|
||||
* 权限控制类
|
||||
* @var Auth
|
||||
*/
|
||||
protected $auth = null;
|
||||
|
||||
/**
|
||||
* 模型对象
|
||||
* @var \think\Model
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
/**
|
||||
* 快速搜索时执行查找的字段
|
||||
*/
|
||||
protected $searchFields = 'id';
|
||||
|
||||
/**
|
||||
* 是否是关联查询
|
||||
*/
|
||||
protected $relationSearch = false;
|
||||
|
||||
/**
|
||||
* 是否开启数据限制
|
||||
* 支持auth/personal
|
||||
@ -66,76 +55,59 @@ class Backend extends Controller
|
||||
* 默认为禁用,若启用请务必保证表中存在admin_id字段
|
||||
*/
|
||||
protected $dataLimit = false;
|
||||
|
||||
/**
|
||||
* 数据限制字段
|
||||
*/
|
||||
protected $dataLimitField = 'admin_id';
|
||||
|
||||
/**
|
||||
* 数据限制开启时自动填充限制字段值
|
||||
*/
|
||||
protected $dataLimitFieldAutoFill = true;
|
||||
|
||||
/**
|
||||
* 是否开启Validate验证
|
||||
*/
|
||||
protected $modelValidate = false;
|
||||
|
||||
/**
|
||||
* 是否开启模型场景验证
|
||||
*/
|
||||
protected $modelSceneValidate = false;
|
||||
|
||||
/**
|
||||
* Multi方法可批量修改的字段
|
||||
*/
|
||||
protected $multiFields = 'status';
|
||||
|
||||
/**
|
||||
* Selectpage可显示的字段
|
||||
*/
|
||||
protected $selectpageFields = '*';
|
||||
|
||||
/**
|
||||
* 前台提交过来,需要排除的字段数据
|
||||
*/
|
||||
protected $excludeFields = "";
|
||||
|
||||
/**
|
||||
* 导入文件首行类型
|
||||
* 支持comment/name
|
||||
* 表示注释或字段名
|
||||
*/
|
||||
protected $importHeadType = 'comment';
|
||||
|
||||
/**
|
||||
* 引入后台控制器的traits
|
||||
*/
|
||||
use \app\admin\library\traits\Backend;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
$modulename = $this->request->module();
|
||||
$controllername = Loader::parseName($this->request->controller());
|
||||
$actionname = strtolower($this->request->action());
|
||||
|
||||
$path = str_replace('.', '/', $controllername) . '/' . $actionname;
|
||||
|
||||
// 定义是否Addtabs请求
|
||||
!defined('IS_ADDTABS') && define('IS_ADDTABS', input("addtabs") ? true : false);
|
||||
|
||||
// 定义是否Dialog请求
|
||||
!defined('IS_DIALOG') && define('IS_DIALOG', input("dialog") ? true : false);
|
||||
|
||||
// 定义是否AJAX请求
|
||||
!defined('IS_AJAX') && define('IS_AJAX', $this->request->isAjax());
|
||||
|
||||
// 检测IP是否允许
|
||||
check_ip_allowed();
|
||||
|
||||
$this->auth = Auth::instance();
|
||||
|
||||
// 设置当前请求的URI
|
||||
$this->auth->setRequestUri($path);
|
||||
// 检测是否需要验证登录
|
||||
@ -160,7 +132,6 @@ class Backend extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 非选项卡时重定向
|
||||
if (!$this->request->isPost() && !IS_AJAX && !IS_ADDTABS && !IS_DIALOG && input("ref") == 'addtabs') {
|
||||
$url = preg_replace_callback("/([\?|&]+)ref=addtabs(&?)/i", function ($matches) {
|
||||
@ -175,7 +146,6 @@ class Backend extends Controller
|
||||
$this->redirect('index/index', [], 302, ['referer' => $url]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// 设置面包屑导航数据
|
||||
$breadcrumb = [];
|
||||
if (!IS_DIALOG && !config('fastadmin.multiplenav') && config('fastadmin.breadcrumb')) {
|
||||
@ -183,22 +153,16 @@ class Backend extends Controller
|
||||
array_pop($breadcrumb);
|
||||
}
|
||||
$this->view->breadcrumb = $breadcrumb;
|
||||
|
||||
// 如果有使用模板布局
|
||||
if ($this->layout) {
|
||||
$this->view->engine->layout('layout/' . $this->layout);
|
||||
}
|
||||
|
||||
// 语言检测
|
||||
$lang = strip_tags($this->request->langset());
|
||||
|
||||
$site = Config::get("site");
|
||||
|
||||
$upload = \app\common\model\Config::upload();
|
||||
|
||||
// 上传信息配置后
|
||||
Hook::listen("upload_config_init", $upload);
|
||||
|
||||
// 配置信息
|
||||
$config = [
|
||||
'site' => array_intersect_key($site, array_flip(['name', 'indexurl', 'cdnurl', 'version', 'timezone', 'languages'])),
|
||||
@ -212,9 +176,7 @@ class Backend extends Controller
|
||||
'referer' => Session::get("referer")
|
||||
];
|
||||
$config = array_merge($config, Config::get("view_replace_str"));
|
||||
|
||||
Config::set('upload', array_merge(Config::get('upload'), $upload));
|
||||
|
||||
// 配置信息后
|
||||
Hook::listen("config_init", $config);
|
||||
//加载当前控制器语言包
|
||||
@ -228,7 +190,6 @@ class Backend extends Controller
|
||||
//渲染管理员对象
|
||||
$this->assign('admin', Session::get('admin'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载语言文件
|
||||
* @param string $name
|
||||
@ -238,7 +199,6 @@ class Backend extends Controller
|
||||
$name = Loader::parseName($name);
|
||||
Lang::load(APP_PATH . $this->request->module() . '/lang/' . $this->request->langset() . '/' . str_replace('.', '/', $name) . '.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染配置信息
|
||||
* @param mixed $name 键名或数组
|
||||
@ -248,7 +208,6 @@ class Backend extends Controller
|
||||
{
|
||||
$this->view->config = array_merge($this->view->config ? $this->view->config : [], is_array($name) ? $name : [$name => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成查询所需要的条件,排序方式
|
||||
* @param mixed $searchfields 快速查询的字段
|
||||
@ -324,7 +283,6 @@ class Backend extends Controller
|
||||
$sym = '=';
|
||||
}
|
||||
}
|
||||
|
||||
switch ($sym) {
|
||||
case '=':
|
||||
case '<>':
|
||||
@ -430,7 +388,6 @@ class Backend extends Controller
|
||||
};
|
||||
return [$where, $sort, $order, $offset, $limit, $page, $alias, $bind];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据限制的管理员ID
|
||||
* 禁用数据限制时返回的是null
|
||||
@ -450,7 +407,6 @@ class Backend extends Controller
|
||||
}
|
||||
return $adminIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selectpage的实现方法
|
||||
*
|
||||
@ -462,7 +418,6 @@ class Backend extends Controller
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['trim', 'strip_tags', 'htmlspecialchars']);
|
||||
|
||||
//搜索关键词,客户端输入以空格分开,这里接收为数组
|
||||
$word = (array)$this->request->request("q_word/a");
|
||||
//当前页
|
||||
@ -495,7 +450,6 @@ class Backend extends Controller
|
||||
$order[$v[0]] = $v[1];
|
||||
}
|
||||
$field = $field ? $field : 'name';
|
||||
|
||||
//如果有primaryvalue,说明当前是初始化传值
|
||||
if ($primaryvalue !== null) {
|
||||
$where = [$primarykey => ['in', $primaryvalue]];
|
||||
@ -538,9 +492,7 @@ class Backend extends Controller
|
||||
if (is_array($adminIds)) {
|
||||
$this->model->where($this->dataLimitField, 'in', $adminIds);
|
||||
}
|
||||
|
||||
$fields = is_array($this->selectpageFields) ? $this->selectpageFields : ($this->selectpageFields && $this->selectpageFields != '*' ? explode(',', $this->selectpageFields) : []);
|
||||
|
||||
//如果有primaryvalue,说明当前是初始化传值,按照选择顺序排序
|
||||
if ($primaryvalue !== null && preg_match("/^[a-z0-9_\-]+$/i", $primarykey)) {
|
||||
$primaryvalue = array_unique(is_array($primaryvalue) ? $primaryvalue : explode(',', $primaryvalue));
|
||||
@ -548,18 +500,14 @@ class Backend extends Controller
|
||||
$primaryvalue = array_map(function ($value) {
|
||||
return '\'' . $value . '\'';
|
||||
}, $primaryvalue);
|
||||
|
||||
$primaryvalue = implode(',', $primaryvalue);
|
||||
|
||||
$this->model->orderRaw("FIELD(`{$primarykey}`, {$primaryvalue})");
|
||||
} else {
|
||||
$this->model->order($order);
|
||||
}
|
||||
|
||||
$datalist = $this->model->where($where)
|
||||
->page($page, $pagesize)
|
||||
->select();
|
||||
|
||||
foreach ($datalist as $index => $item) {
|
||||
unset($item['password'], $item['salt']);
|
||||
if ($this->selectpageFields == '*') {
|
||||
@ -588,19 +536,16 @@ class Backend extends Controller
|
||||
//这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮
|
||||
return json(['list' => $list, 'total' => $total]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新Token
|
||||
*/
|
||||
protected function token()
|
||||
{
|
||||
$token = $this->request->param('__token__');
|
||||
|
||||
//验证Token
|
||||
if (!Validate::make()->check(['__token__' => $token], ['__token__' => 'require|token'])) {
|
||||
$this->error(__('Token verification error'), '', ['__token__' => $this->request->token()]);
|
||||
}
|
||||
|
||||
//刷新Token
|
||||
$this->request->token();
|
||||
}
|
||||
@ -695,4 +640,38 @@ class Backend extends Controller
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 判断是否为合法的身份证号码
|
||||
* @param $mobile
|
||||
* @return int
|
||||
*/
|
||||
public function isCreditNo($vStr)
|
||||
{
|
||||
$vCity = array(
|
||||
'11', '12', '13', '14', '15', '21', '22',
|
||||
'23', '31', '32', '33', '34', '35', '36',
|
||||
'37', '41', '42', '43', '44', '45', '46',
|
||||
'50', '51', '52', '53', '54', '61', '62',
|
||||
'63', '64', '65', '71', '81', '82', '91'
|
||||
);
|
||||
if (!preg_match('/^([\d]{17}[xX\d]|[\d]{15})$/', $vStr)) return false;
|
||||
if (!in_array(substr($vStr, 0, 2), $vCity)) return false;
|
||||
$vStr = preg_replace('/[xX]$/i', 'a', $vStr);
|
||||
$vLength = strlen($vStr);
|
||||
if ($vLength == 18) {
|
||||
$vBirthday = substr($vStr, 6, 4) . '-' . substr($vStr, 10, 2) . '-' . substr($vStr, 12, 2);
|
||||
} else {
|
||||
$vBirthday = '19' . substr($vStr, 6, 2) . '-' . substr($vStr, 8, 2) . '-' . substr($vStr, 10, 2);
|
||||
}
|
||||
if (date('Y-m-d', strtotime($vBirthday)) != $vBirthday) return false;
|
||||
if ($vLength == 18) {
|
||||
$vSum = 0;
|
||||
for ($i = 17; $i >= 0; $i--) {
|
||||
$vSubStr = substr($vStr, 17 - $i, 1);
|
||||
$vSum += (pow(2, $i) % 11) * (($vSubStr == 'a') ? 10 : intval($vSubStr, 11));
|
||||
}
|
||||
if ($vSum % 11 != 1) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ return array (
|
||||
'name' => '会员管理',
|
||||
'beian' => '',
|
||||
'cdnurl' => '',
|
||||
'version' => '1.0.4',
|
||||
'version' => '1.0.16',
|
||||
'timezone' => 'Asia/Shanghai',
|
||||
'forbiddenip' => '',
|
||||
'languages' =>
|
||||
@ -39,4 +39,9 @@ return array (
|
||||
'category2' => '分类二',
|
||||
),
|
||||
'integral_rate' => '1',
|
||||
'sms_userid' => '5838',
|
||||
'sms_user' => '盛世鑫鼎比亚迪',
|
||||
'sms_passwd' => '123456',
|
||||
'birthday_sms' => '【比亚迪汽车】亲爱的[姓氏][称呼],祝您生日快乐,平安健康,美好常伴。退订回T',
|
||||
'expireins_sms' => '【比亚迪汽车】亲爱的[姓氏][称呼],您的车辆保险购买日期为[保险日期],即将到期。咨询续保请联系我们。退订回T',
|
||||
);
|
||||
|
294
extend/car/Sms.php
Normal file
294
extend/car/Sms.php
Normal file
@ -0,0 +1,294 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2011 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: luofei614 <weibo.com/luofei614>
|
||||
// +----------------------------------------------------------------------
|
||||
// | 修改者: anuo (本权限类在原3.2.3的基础上修改过来的)
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace car;
|
||||
|
||||
use think\Db;
|
||||
use think\Config;
|
||||
use think\Session;
|
||||
use think\Request;
|
||||
use fast\Http;
|
||||
use app\common\model\user4s\User;
|
||||
|
||||
/**
|
||||
* 企信通短信
|
||||
*/
|
||||
class Sms
|
||||
{
|
||||
|
||||
/**
|
||||
* @var object 对象实例
|
||||
*/
|
||||
protected static $instance;
|
||||
protected $rules = [];
|
||||
|
||||
/**
|
||||
* http实例
|
||||
* @var Http
|
||||
*/
|
||||
protected $http;
|
||||
//默认配置
|
||||
protected $config = [
|
||||
'url' => 'http://47.106.229.82:8888/', // 接口地址
|
||||
'userid' => 1, // 企业ID
|
||||
'account' => '', // 账号
|
||||
'password' => '', // 密码
|
||||
];
|
||||
|
||||
public function __construct($options = [])
|
||||
{
|
||||
if ($auth = Config::get('sms')) {
|
||||
$this->config = array_merge($this->config, $auth);
|
||||
}
|
||||
if(!empty($options)){
|
||||
$this->config = array_merge($this->config, $options);
|
||||
}
|
||||
$this->http = new Http;
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 给用户发送短信 支持变量模板
|
||||
[ID]
|
||||
[姓名] 张三
|
||||
[姓氏] 张
|
||||
[联系方式] 1526425507
|
||||
[余额] 1.00
|
||||
[积分] 100
|
||||
[性别] 男 女
|
||||
[称呼] 先生 女士
|
||||
[身份证] 3713261xxxxxxxxx
|
||||
[生日] 2022-05-08
|
||||
[购车日期] 2022-05-08
|
||||
[车牌号码] 鲁Q12345
|
||||
[车架号] LGXC14DF6L0127066
|
||||
[车型] 宋经典手动
|
||||
[颜色] 水晶白
|
||||
[保险类型] 交强险
|
||||
[保险公司] 平安保险 人保
|
||||
[保险日期] 2022-05-08
|
||||
[备注]
|
||||
* @return array
|
||||
*/
|
||||
public function send($uid,$content,$sendTime='')
|
||||
{
|
||||
if(!is_array($uid)){
|
||||
$user_ids[] = $uid;
|
||||
}else{
|
||||
$user_ids = $uid;
|
||||
}
|
||||
if(empty($user_ids) || empty($content)){
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = '用户ID或内容为空';
|
||||
return $res;
|
||||
}
|
||||
|
||||
$return = array('code' => 1, 'total' => 0, 'success' => 0);
|
||||
$user = new User;
|
||||
$list = User::where('id', 'in', $user_ids)->select();
|
||||
$list = collection($list)->toarray();
|
||||
$user_list = array_column($list, null, 'id');
|
||||
|
||||
$prefix = Config::get('database.prefix');
|
||||
$fieldArr = [];
|
||||
$table = $prefix . 'user4s_user';
|
||||
$database = Config::get('database.database');
|
||||
$pk = Db::getTableInfo($table, 'pk');
|
||||
$list = db()->query(
|
||||
"SELECT COLUMN_NAME,COLUMN_COMMENT,COLUMN_TYPE,IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ? AND TABLE_SCHEMA = ?",
|
||||
[$table, $database]
|
||||
);
|
||||
foreach ($list as $k => $v) {
|
||||
if ($v['COLUMN_NAME'] !== $pk) {
|
||||
$fieldArr[$v['COLUMN_COMMENT']] = $v; //['COLUMN_NAME']
|
||||
}
|
||||
}
|
||||
foreach ($user_ids as $u) {
|
||||
if (!empty($user_list[$u]['tel'])) {
|
||||
foreach ($fieldArr as $name => $field) {
|
||||
if (stripos($name, ':') != false) {
|
||||
$name = explode(':', $name, 2)[0];
|
||||
}
|
||||
if (stripos($content, '[' . $name . ']') != false && !empty($user_list[$u][$field['COLUMN_NAME']])) {
|
||||
$content = str_replace('[' . $name . ']', $user_list[$u][$field['COLUMN_NAME']], $content);
|
||||
}
|
||||
if(stripos($content, '[称呼]') != false){
|
||||
if ($user_list[$u]['genderdata'] == 'female') {
|
||||
$content = str_replace('[称呼]', '女士', $content);
|
||||
}else{
|
||||
$content = str_replace('[称呼]', '先生', $content);
|
||||
}
|
||||
}
|
||||
if(stripos($content, '[姓氏]') != false){
|
||||
$xingshi = mb_substr($user_list[$u]['name'], 0, 1, 'utf-8');
|
||||
$content = str_replace('[姓氏]', $xingshi, $content);
|
||||
}
|
||||
if (stripos($content, 'male') != false) {
|
||||
$content = str_replace('male', '男', $content);
|
||||
}
|
||||
if (stripos($content, 'female') != false) {
|
||||
$content = str_replace('female', '女', $content);
|
||||
}
|
||||
}
|
||||
//todo:测试
|
||||
$res = $this->sendsms($user_list[$u]['tel'], $content, $sendTime,$user_list[$u]['id']);
|
||||
//$res = array('status'=>false,'message'=>'手机号为空');
|
||||
if ($res['status'] == true) {
|
||||
$return['status'][] = array('code' => 1,'name'=>$user_list[$u]['name'],'tel'=>$user_list[$u]['tel'], 'msg' => '发送成功');
|
||||
$return['total'] = $return['total'] + 1;
|
||||
$return['success'] = $return['success'] + 1;
|
||||
} else {
|
||||
$return['status'][] = array('code' => 0,'name'=>$user_list[$u]['name'],'tel'=>$user_list[$u]['tel'], 'msg' => $res['message']);
|
||||
$return['total'] = $return['total'] + 1;
|
||||
}
|
||||
} else {
|
||||
$return['total'] = $return['total'] + 1;
|
||||
$return['status'][] = array('code' => 0,'name'=>$user_list[$u]['name'],'tel'=>$user_list[$u]['tel'], 'msg' => '手机号为空');
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
/**
|
||||
* 根据手机号发送短信
|
||||
* @return array
|
||||
*/
|
||||
public function sendsms($mobile,$content,$sendTime='',$user_id=0)
|
||||
{
|
||||
if(empty($mobile) || empty($content)){
|
||||
$res['status'] = false;
|
||||
$res['message'] = '手机号或内容为空';
|
||||
return $res;
|
||||
}
|
||||
$url = $this->config['url'].'sms.aspx';
|
||||
$params = $this->config;
|
||||
unset($params['url']);
|
||||
$params['action'] = 'send';
|
||||
$params['extno'] = '';
|
||||
$params['mobile'] = is_array($mobile)?implode(',', $mobile):$mobile;
|
||||
$params['content'] = $content;
|
||||
$params['sendTime'] = !empty($sendTime)?date('Y-m-d H:i:s',strtotime($sendTime)):'';
|
||||
$xml = $this->http->post($url,$params);
|
||||
//var_dump($url,$params,$xml);
|
||||
$res = (array)simplexml_load_string($xml);
|
||||
$log = array(
|
||||
'user_id'=>$user_id,
|
||||
'mobile'=>$mobile,
|
||||
'content'=>$content,
|
||||
'createtime'=>time(),
|
||||
'res'=>json_encode($res,true),
|
||||
'status'=>0,
|
||||
);
|
||||
if($res['returnstatus'] == 'Faild'){
|
||||
$res['status'] = false;
|
||||
}else{
|
||||
$res['status'] = true;
|
||||
$log['status'] = 1;
|
||||
}
|
||||
//$table = Config::get('database.prefix') . 'car_smslog';
|
||||
Db::name('smslog')->insert($log);
|
||||
//var_dump(Db::getlastsql());
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* 上行接口
|
||||
* @return array
|
||||
*/
|
||||
public function getCall()
|
||||
{
|
||||
$url = $this->config['url'].'callApi.aspx';
|
||||
$params = $this->config;
|
||||
unset($params['url']);
|
||||
$params['action'] = 'query';
|
||||
$xml = $this->http->post($url,$params);
|
||||
//var_dump($url,$params,$xml);
|
||||
$res = (array)simplexml_load_string($xml);
|
||||
if(isset($res['errorstatus'])){
|
||||
$res['status'] = false;
|
||||
$res['count'] = 0;
|
||||
return $res;
|
||||
}else{
|
||||
$res['status'] = true;
|
||||
$res['count'] = isset($res['returnsms'])?count($res['returnsms']):0;
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态报告
|
||||
* @return array
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
$url = $this->config['url'].'statusApi.aspx';
|
||||
$params = $this->config;
|
||||
unset($params['url']);
|
||||
$params['action'] = 'query';
|
||||
$xml = $this->http->post($url,$params);
|
||||
//var_dump($url,$params,$xml);
|
||||
$res = (array)simplexml_load_string($xml);
|
||||
if(isset($res['errorstatus'])){
|
||||
$res['status'] = false;
|
||||
return $res;
|
||||
}else{
|
||||
$res['status'] = true;
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 非法关键词查询
|
||||
* @return mixed
|
||||
*/
|
||||
public function check($content)
|
||||
{
|
||||
if(empty($content)){
|
||||
return '短信内容为空';
|
||||
}
|
||||
$url = $this->config['url'].'sms.aspx';
|
||||
$params = $this->config;
|
||||
unset($params['url']);
|
||||
$params['action'] = 'checkkeyword';
|
||||
$params['content'] = $content;
|
||||
$xml = $this->http->post($url,$params);
|
||||
//var_dump($url,$params,$xml);
|
||||
$res = (array)simplexml_load_string($xml);
|
||||
if($res['returnstatus'] == 'Faild'){
|
||||
return $res['message'];
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 余额及已发送量查询
|
||||
* @return mixed
|
||||
*/
|
||||
public function getOverage($params=[])
|
||||
{
|
||||
$url = $this->config['url'].'sms.aspx';
|
||||
$params = array_merge($this->config, $params);
|
||||
unset($params['url']);
|
||||
$params['action'] = 'overage';
|
||||
$xml = $this->http->post($url,$params);
|
||||
$res = (array)simplexml_load_string($xml);
|
||||
if($res['returnstatus'] == 'Faild'){
|
||||
$res['status'] = false;
|
||||
return $res;
|
||||
}else{
|
||||
$res['status'] = true;
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
}
|
@ -11,7 +11,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
del_url: 'user4s/inslog/del',
|
||||
multi_url: 'user4s/inslog/multi',
|
||||
import_url: 'user4s/inslog/import',
|
||||
table: 'user4s_inslog',
|
||||
excel_url:'user4s/inslog/excel',
|
||||
table: 'user4s_inslog' + location.search,
|
||||
}
|
||||
});
|
||||
|
||||
@ -32,20 +33,25 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
//{field: 'id', title: __('Id'),operate: false},
|
||||
//{field: 'user4s_id', title: __('User4s_id'),operate: false},
|
||||
//{field: 'admin_id', title: __('Admin_id'),operate: false},
|
||||
{field: 'user.name', title: __('会员姓名'), operate: 'LIKE'},
|
||||
{ field: 'user.name', title: __('会员电话'), operate: 'LIKE', visible: false },
|
||||
{ field: 'user.name', title: __('会员姓名'), operate: 'LIKE' },
|
||||
{ field: 'user.tel', title: __('联系方式'), operate: 'LIKE' },
|
||||
{ field: 'user.tel', title: __('联系方式'), operate: 'LIKE' },
|
||||
{ field: 'user.buydate', title: __('User.Buydate'), operate: false, addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false },
|
||||
{ field: 'user.carno', title: __('User.Carno'), operate: false },
|
||||
{ field: 'user.frameno', title: __('车架号'), operate: false,visible:false},
|
||||
{ field: 'user.model', title: __('User.Model'), operate: false,visible:false},
|
||||
{ field: 'user.color', title: __('User.Color'), operate: false,visible:false },
|
||||
//{ field: 'user.name', title: __('会员电话'), operate: 'LIKE', visible: false },
|
||||
|
||||
{ field: 'inscom', title: __('Inscom'), operate: 'LIKE', editable: true },
|
||||
{field: 'instype', title: __('Instype'), operate: 'LIKE',editable:true},
|
||||
{ field: 'insdate', title: __('Insdate'), operate: 'BETWEEN', addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false },
|
||||
{field: 'description', title: __('Description'), operate: 'LIKE',editable:true},
|
||||
{field: 'star_f', title: __('Star'),operate:false},
|
||||
{ field: 'createtime_f', title: __('续保时间'), operate: false },
|
||||
//{ field: 'createtime_f', title: __('续保时间'), operate: false },
|
||||
{field: 'createtime', title: __('续保时间'),datetimeFormat:'YYYY-MM-DD', operate: 'BETWEEN', addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false,visible: false},
|
||||
{field: 'admin.id', title: __('Admin.id'),operate: false,visible: false},
|
||||
{field: 'admin.nickname', title: __('操作员'), operate: false},
|
||||
|
||||
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
],
|
||||
@ -67,7 +73,42 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
return params;
|
||||
},
|
||||
});
|
||||
table.on('load-success.bs.table', function (e, data) {
|
||||
$("#start_date").val(data.extend.start_data);
|
||||
$("#end_date").val(data.extend.end_data);
|
||||
});
|
||||
require(['bootstrap-datetimepicker'], function () {
|
||||
var options = {
|
||||
format: 'YYYY-MM-DD',
|
||||
icons: {
|
||||
time: 'fa fa-clock-o',
|
||||
date: 'fa fa-calendar',
|
||||
up: 'fa fa-chevron-up',
|
||||
down: 'fa fa-chevron-down',
|
||||
previous: 'fa fa-chevron-left',
|
||||
next: 'fa fa-chevron-right',
|
||||
today: 'fa fa-history',
|
||||
clear: 'fa fa-trash',
|
||||
close: 'fa fa-remove'
|
||||
},
|
||||
showTodayButton: true,
|
||||
showClose: true
|
||||
};
|
||||
$('#start_date').parent().css('position', 'relative');
|
||||
$("#start_date").datetimepicker(options);
|
||||
$('#end_date').parent().css('position', 'relative');
|
||||
$("#end_date").datetimepicker(options);
|
||||
});
|
||||
|
||||
|
||||
$(document).on("click", ".btn-excel", function () {
|
||||
var start_date = $("#start_date").val();
|
||||
var end_date = $("#end_date").val();
|
||||
var url = 'inslog/excel'+'?start_date='+start_date+'&end_date='+end_date;
|
||||
//Fast.api.open(url, '发送短信');
|
||||
window.open(url,'_self');
|
||||
//Fast.api.open(url,title ,options);
|
||||
});
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
|
@ -11,6 +11,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
del_url: 'user4s/user/del',
|
||||
multi_url: 'user4s/user/multi',
|
||||
import_url: 'user4s/user/import',
|
||||
sms_url: 'user4s/user/sms',
|
||||
table: 'user4s_user',
|
||||
}
|
||||
});
|
||||
@ -25,41 +26,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
fixedColumns: true,
|
||||
fixedRightNumber: 1,
|
||||
showToggle: false,
|
||||
//maintainSelected: true,
|
||||
// queryParams:function(params){
|
||||
// var filter, op, tableId = Fast.api.query('tables_id');
|
||||
// if(tableId){
|
||||
// filter = JSON.parse(params.filter);
|
||||
// op = JSON.parse(params.op);
|
||||
|
||||
// filter.tables_id = tableId;
|
||||
// op.tables_id = '=';
|
||||
// params.filter = JSON.stringify(filter);
|
||||
// params.op = JSON.stringify(op);
|
||||
// }
|
||||
// return params;
|
||||
// },
|
||||
// queryParams: function (params) {
|
||||
// console.log(params);
|
||||
// console.log(Fast.api.query('status'));
|
||||
// //这里可以追加搜索条件
|
||||
// var filter = JSON.parse(params.filter);
|
||||
// var op = JSON.parse(params.op);
|
||||
// //这里可以动态赋值,比如从URL中获取admin_id的值,filter.admin_id=Fast.api.query('admin_id');
|
||||
// //filter.admin_id = 1;
|
||||
// //op.admin_id = "=";
|
||||
// params.filter = JSON.stringify(filter);
|
||||
// params.op = JSON.stringify(op);
|
||||
// return params;
|
||||
// },
|
||||
columns: [
|
||||
[
|
||||
{ checkbox: true },
|
||||
{field: 'id', title: __('会员ID'), operate:false},
|
||||
{ field: 'name', title: __('Name'), operate: 'LIKE',editable:true },
|
||||
{ field: 'tel', title: __('Tel'), operate: 'LIKE' ,editable:true},
|
||||
{ field: 'cardid', title: __('身份证号'), operate: '=',visible:false },
|
||||
{ field: 'frameno', title: __('车架号'), operate: '=',visible:false},
|
||||
{ field: 'cardid', title: __('身份证号'), operate: '=',visible:false,editable:true },
|
||||
|
||||
// {
|
||||
// field: 'category_id', title: __('Category_id'), searchList: $.getJSON("user4s/category/searchlist"), formatter: function (value, row, index) {
|
||||
// return row['category']['name'];
|
||||
@ -70,20 +44,30 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
// return row['level']['name'];
|
||||
// }
|
||||
// },
|
||||
{ field: 'category.name', title: __('Category_id'), searchList: $.getJSON("user4s/category/searchlist") },
|
||||
{
|
||||
field: 'category.name', title: __('Category_id'), searchList: $.getJSON("user4s/category/searchlist"),
|
||||
// editable: {
|
||||
// type: 'select',
|
||||
// autotext: true,
|
||||
// inputclass: '',
|
||||
// pk: 'value',
|
||||
// source: "user4s/category/list"
|
||||
// }
|
||||
},
|
||||
{ field: 'level.name', title: __('Level_id'), searchList: $.getJSON("user4s/level/searchlist") },
|
||||
{ field: 'balance', title: __('Balance'), operate: false},
|
||||
{ field: 'integral', title: __('Integral'), operate: false },
|
||||
//{field: 'city', title: __('City'), operate: 'LIKE'},
|
||||
{ field: 'buydate', title: __('Buydate'), operate: 'BETWEEN', addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false },
|
||||
{ field: 'carno', title: __('Carno'), operate: false ,editable:true},
|
||||
{ field: 'frameno', title: __('车架号'), operate: 'LIKE',visible:false,editable:true},
|
||||
{ field: 'model', title: __('Model'), operate: false ,editable:true},
|
||||
{ field: 'color', title: __('Color'), operate: false ,editable:true},
|
||||
{ field: 'inscom', title: __('保险公司'), operate: false, visible: false },
|
||||
{field: 'instype', title: __('保险类型'), operate: false,visible:false},
|
||||
{ field: 'insdate', title: __('Insdate'), operate: 'BETWEEN', addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false },
|
||||
//{field: 'tags', title: __('Tags'), operate: 'LIKE', formatter: Table.api.formatter.flag},
|
||||
//{field: 'description', title: __('Description'), operate:false},
|
||||
{field: 'description', title: __('Description'), operate:false},
|
||||
{
|
||||
field: 'admin_id', title: __('Admin_id'), operate: false,visible:false, formatter: function (value, row, index) {
|
||||
return row['fuzheren'];
|
||||
@ -149,19 +133,57 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
|
||||
//当表格数据加载完成时
|
||||
// //点击跳转
|
||||
// $(document).on("click", ".jump", function () {
|
||||
// var url = $(this).attr('data-url');
|
||||
// window.open(url);
|
||||
// });
|
||||
$(document).on("click", ".btn-sms", function () {
|
||||
var ids = Table.api.selectedids(table);
|
||||
var title = $(this).data("original-title") || $(this).attr("title");
|
||||
var url = $.fn.bootstrapTable.defaults.extend.sms_url+'?ids='+ids.join(',');
|
||||
var options = {
|
||||
shadeclose: false,
|
||||
area: $(this).data("data-area"),
|
||||
title: title,
|
||||
callback:function(data){
|
||||
console.log(data);
|
||||
|
||||
}
|
||||
};
|
||||
//Fast.api.open(url, '发送短信');
|
||||
Fast.api.open(url,title ,options);
|
||||
});
|
||||
// table.on('Table.api.events.operate', function (e, data) {
|
||||
// //这里可以获取从服务端获取的JSON数据
|
||||
// console.log(data);
|
||||
// console.log(e);
|
||||
// });
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
sms: function(){
|
||||
Form.api.bindevent($("form[role=form]"), function (data, ret) {
|
||||
console.log('OK', data);
|
||||
if (data.success == data.total) {
|
||||
Fast.api.close(data);//这里是重点
|
||||
return true;
|
||||
} else {
|
||||
$("#sms_status").html('');
|
||||
data.status.forEach((item, index, arr) => {
|
||||
var html = $("#sms_status").html();
|
||||
if (item.code == 0) {
|
||||
html = html + '<span class="label label-warning" style="margin-right: 0.2em;">'+item.name+'('+item.msg+')</span>';
|
||||
} else {
|
||||
html = html + '<span class="label label-info" style="margin-right: 0.2em;">' + item.name + '(' + item.msg + ')</span>';
|
||||
}
|
||||
|
||||
$("#sms_status").html(html);
|
||||
return false;
|
||||
})
|
||||
}
|
||||
}, function (data, ret) {
|
||||
console.log('error',data);
|
||||
Fast.api.close(data);
|
||||
});
|
||||
},
|
||||
recyclebin: function () {
|
||||
// 初始化表格参数配置
|
||||
@ -223,7 +245,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
|
||||
add: function () {
|
||||
$('#c-balance').on('change', function () {
|
||||
var balance = $(this).val();
|
||||
@ -294,6 +315,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'user4s/user/expireins' + location.search,
|
||||
sms_url: 'user4s/user/sms',
|
||||
table: 'user4s_user',
|
||||
}
|
||||
});
|
||||
@ -304,8 +326,43 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
//这里可以获取从服务端获取的JSON数据
|
||||
console.log(data);
|
||||
//这里我们手动设置底部的值
|
||||
$("#start_date").text(data.extend.start_date);
|
||||
$("#end_date").text(data.extend.end_date);
|
||||
$("#start_date").val(data.extend.start_date);
|
||||
$("#end_date").val(data.extend.end_date);
|
||||
});
|
||||
require(['bootstrap-datetimepicker'], function () {
|
||||
var options = {
|
||||
format: 'MM-DD',
|
||||
icons: {
|
||||
time: 'fa fa-clock-o',
|
||||
date: 'fa fa-calendar',
|
||||
up: 'fa fa-chevron-up',
|
||||
down: 'fa fa-chevron-down',
|
||||
previous: 'fa fa-chevron-left',
|
||||
next: 'fa fa-chevron-right',
|
||||
today: 'fa fa-history',
|
||||
clear: 'fa fa-trash',
|
||||
close: 'fa fa-remove'
|
||||
},
|
||||
showTodayButton: true,
|
||||
showClose: true
|
||||
};
|
||||
var dchage = function (e) {
|
||||
var start_date = $("#start_date").val();
|
||||
var end_date = $("#end_date").val();
|
||||
table.bootstrapTable('refresh', { query: { start_date: start_date, end_date: end_date } });
|
||||
};
|
||||
$('#start_date').parent().css('position', 'relative');
|
||||
$("#start_date").datetimepicker(options).on('dp.change', function (e) {
|
||||
var start_date = $("#start_date").val();
|
||||
var end_date = $("#end_date").val();
|
||||
table.bootstrapTable('refresh', { query: { start_date: start_date,end_date:end_date } });
|
||||
});
|
||||
$('#end_date').parent().css('position', 'relative');
|
||||
$("#end_date").datetimepicker(options).on('dp.change', function (e) {
|
||||
var start_date = $("#start_date").val();
|
||||
var end_date = $("#end_date").val();
|
||||
table.bootstrapTable('refresh', { query: { start_date: start_date,end_date:end_date } });
|
||||
});
|
||||
});
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
@ -326,20 +383,73 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
//{ field: 'integral', title: __('Integral'), operate: false },
|
||||
{ field: 'buydate', title: __('Buydate'), operate: false},
|
||||
{ field: 'carno', title: __('Carno'), operate: 'LIKE' },
|
||||
{ field: 'frameno', title: __('车架号'), operate: 'LIKE' },
|
||||
{ field: 'model', title: __('Model'), operate: false },
|
||||
{ field: 'color', title: __('Color'), operate: false },
|
||||
|
||||
{ field: 'inscom', title: __('Inscom'), operate: 'LIKE' },
|
||||
{field: 'instype', title: __('Instype'), operate: 'LIKE'},
|
||||
{ field: 'insdate', title: __('Insdate'), operate: 'BETWEEN', addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false },
|
||||
{
|
||||
field: 'admin_id', title: __('Admin_id'), operate: false, formatter: function (value, row, index) {
|
||||
return row['fuzheren'];
|
||||
}
|
||||
},
|
||||
{ field: 'insdate', title: __('Insdate'), operate: false, addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false },
|
||||
// {
|
||||
// field: 'admin_id', title: __('Admin_id'), operate: false, formatter: function (value, row, index) {
|
||||
// return row['fuzheren'];
|
||||
// }
|
||||
// },
|
||||
{
|
||||
field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
|
||||
buttons: [
|
||||
{
|
||||
name: 'instip',
|
||||
text: __('提醒'),
|
||||
title: __('提醒'),
|
||||
classname: 'btn btn-xs btn-success btn-ajax',
|
||||
icon: 'fa fa-bell-o',
|
||||
url: 'user4s/user/instip?ids={ids}',
|
||||
confirm:"确认本次续保时间内已提醒过用户了吗?",
|
||||
extend: 'data-area=\'["1000px","800px"]\'',
|
||||
success: function (data,ret) {
|
||||
//Layer.alert(ret.msg, { title: "保险临期提醒" });
|
||||
table.bootstrapTable('refresh');
|
||||
},
|
||||
error: function (data, ret) {
|
||||
console.log(data, ret);
|
||||
Layer.alert(ret.msg);
|
||||
return false;
|
||||
},
|
||||
visible: function (row) {
|
||||
if (row.instip == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'instip',
|
||||
text: __('取消提醒'),
|
||||
title: __('取消提醒'),
|
||||
classname: 'btn btn-xs btn-success btn-ajax',
|
||||
icon: 'fa fa-bell-slash-o',
|
||||
url: 'user4s/user/instipno?ids={ids}',
|
||||
confirm:"取消本次续保时间内的提醒状态吗?",
|
||||
extend: 'data-area=\'["1000px","800px"]\'',
|
||||
success: function (data,ret) {
|
||||
//Layer.alert(ret.msg, { title: "保险临期提醒" });
|
||||
table.bootstrapTable('refresh');
|
||||
},
|
||||
error: function (data, ret) {
|
||||
console.log(data, ret);
|
||||
Layer.alert(ret.msg);
|
||||
return false;
|
||||
},
|
||||
visible: function (row) {
|
||||
if (row.instip == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'renewal',
|
||||
text: __('续保'),
|
||||
@ -372,6 +482,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
],
|
||||
|
||||
});
|
||||
$(document).on("click", ".btn-sms", function () {
|
||||
var ids = Table.api.selectedids(table);
|
||||
var title = $(this).data("original-title") || $(this).attr("title");
|
||||
var url = $.fn.bootstrapTable.defaults.extend.sms_url+'?ids='+ids.join(',');
|
||||
var options = {
|
||||
shadeclose: false,
|
||||
area: $(this).data("data-area"),
|
||||
title: title,
|
||||
callback:function(data){
|
||||
console.log(data);
|
||||
|
||||
}
|
||||
};
|
||||
//Fast.api.open(url, '发送短信');
|
||||
Fast.api.open(url,title ,options);
|
||||
});
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
@ -383,6 +509,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'user4s/user/birthday' + location.search,
|
||||
sms_url: 'user4s/user/sms',
|
||||
table: 'user4s_user',
|
||||
}
|
||||
});
|
||||
@ -394,6 +521,38 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
console.log(data);
|
||||
//这里我们手动设置底部的值
|
||||
$("#start_date").text(data.extend.start_date);
|
||||
$("#m-birthday").val(data.extend.start_date);
|
||||
//$("#birthday").datetimepicker();
|
||||
require(['bootstrap-datetimepicker'], function () {
|
||||
var options = {
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
icons: {
|
||||
time: 'fa fa-clock-o',
|
||||
date: 'fa fa-calendar',
|
||||
up: 'fa fa-chevron-up',
|
||||
down: 'fa fa-chevron-down',
|
||||
previous: 'fa fa-chevron-left',
|
||||
next: 'fa fa-chevron-right',
|
||||
today: 'fa fa-history',
|
||||
clear: 'fa fa-trash',
|
||||
close: 'fa fa-remove'
|
||||
},
|
||||
showTodayButton: true,
|
||||
showClose: true
|
||||
};
|
||||
$('#m-birthday').parent().css('position', 'relative');
|
||||
$("#m-birthday").datetimepicker(options).on('dp.change', function (e) {
|
||||
var birthday = $("#m-birthday").val();
|
||||
//console.log(e);
|
||||
//console.log(birthday);
|
||||
table.bootstrapTable('refresh', {query: {birthday: birthday}});
|
||||
//$(this, document).trigger("changed");
|
||||
|
||||
});
|
||||
// $('.search',$("form[role=form]")).parent().css('position', 'relative');
|
||||
// $('.search',$("form[role=form]")).datetimepicker(options);
|
||||
});
|
||||
|
||||
});
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
@ -403,23 +562,25 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
fixedColumns: true,
|
||||
fixedRightNumber: 1,
|
||||
showToggle: false,
|
||||
//maintainSelected: true,
|
||||
// searchFormVisible: true,
|
||||
// searchFormTemplate: 'customformtpl',
|
||||
maintainSelected: true,
|
||||
columns: [
|
||||
[
|
||||
{ checkbox: true },
|
||||
//{field: 'id', title: __('Id'), operate:false},
|
||||
{ field: 'name', title: __('Name'), operate: 'LIKE' },
|
||||
{ field: 'tel', title: __('Tel'), operate: 'LIKE' },
|
||||
{ field: 'birthday', title: __('生日'), operate: false},
|
||||
{ field: 'cardid', title: __('Cardid'), operate: false },
|
||||
{ field: 'birthday', title: __('生日'), operate: false, addclass: 'datetimepicker',data: 'data-date-format="MM-DD",data-date-use-current="true"', autocomplete: false},
|
||||
{ field: 'cardid', title: __('Cardid'), operate: 'LIKE' },
|
||||
{ field: 'buydate', title: __('Buydate'), operate: false},
|
||||
{ field: 'carno', title: __('Carno'), operate: 'LIKE' },
|
||||
{ field: 'model', title: __('Model'), operate: false },
|
||||
{ field: 'color', title: __('Color'), operate: false },
|
||||
|
||||
{ field: 'inscom', title: __('Inscom'), operate: 'LIKE' },
|
||||
{field: 'instype', title: __('Instype'), operate: 'LIKE'},
|
||||
{ field: 'insdate', title: __('Insdate'), operate: 'BETWEEN', addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false },
|
||||
{ field: 'inscom', title: __('Inscom'), operate: false },
|
||||
{field: 'instype', title: __('Instype'), operate: false},
|
||||
{ field: 'insdate', title: __('Insdate'), operate: false, addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false },
|
||||
{
|
||||
field: 'admin_id', title: __('Admin_id'), operate: false, formatter: function (value, row, index) {
|
||||
return row['fuzheren'];
|
||||
@ -460,6 +621,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
],
|
||||
|
||||
});
|
||||
$(document).on("click", ".btn-sms", function () {
|
||||
var ids = Table.api.selectedids(table);
|
||||
var title = $(this).data("original-title") || $(this).attr("title");
|
||||
var url = $.fn.bootstrapTable.defaults.extend.sms_url+'?ids='+ids.join(',');
|
||||
var options = {
|
||||
shadeclose: false,
|
||||
area: $(this).data("data-area"),
|
||||
title: title,
|
||||
callback:function(data){
|
||||
console.log(data);
|
||||
|
||||
}
|
||||
};
|
||||
//Fast.api.open(url, '发送短信');
|
||||
Fast.api.open(url,title ,options);
|
||||
});
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
@ -545,33 +722,33 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
bindevent: function (table) {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
},
|
||||
events: {
|
||||
operate: {
|
||||
'click .btn-delone': function (e, value, row, index) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
var that = this;
|
||||
var top = $(that).offset().top - $(window).scrollTop();
|
||||
var left = $(that).offset().left - $(window).scrollLeft() - 260;
|
||||
if (top + 154 > $(window).height()) {
|
||||
top = top - 154;
|
||||
}
|
||||
if ($(window).width() < 480) {
|
||||
top = left = undefined;
|
||||
}
|
||||
Layer.confirm(
|
||||
__('22222222222222222?'),
|
||||
{icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true, btn: [__('OK'), __('Cancel')]},
|
||||
function (index) {
|
||||
var table = $(that).closest('table');
|
||||
var options = table.bootstrapTable('getOptions');
|
||||
Table.api.multi("del", row[options.pk], table, that);
|
||||
Layer.close(index);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// events: {
|
||||
// operate: {
|
||||
// 'click .btn-delone': function (e, value, row, index) {
|
||||
// e.stopPropagation();
|
||||
// e.preventDefault();
|
||||
// var that = this;
|
||||
// var top = $(that).offset().top - $(window).scrollTop();
|
||||
// var left = $(that).offset().left - $(window).scrollLeft() - 260;
|
||||
// if (top + 154 > $(window).height()) {
|
||||
// top = top - 154;
|
||||
// }
|
||||
// if ($(window).width() < 480) {
|
||||
// top = left = undefined;
|
||||
// }
|
||||
// Layer.confirm(
|
||||
// __('22222222222222222?'),
|
||||
// {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true, btn: [__('OK'), __('Cancel')]},
|
||||
// function (index) {
|
||||
// var table = $(that).closest('table');
|
||||
// var options = table.bootstrapTable('getOptions');
|
||||
// Table.api.multi("del", row[options.pk], table, that);
|
||||
// Layer.close(index);
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
|
@ -6,6 +6,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'user4s/visit/index' + location.search,
|
||||
sms_url: 'user4s/user/sms',
|
||||
add_url: 'user4s/visit/add',
|
||||
edit_url: 'user4s/visit/edit',
|
||||
del_url: 'user4s/visit/del',
|
||||
@ -28,13 +29,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
maintainSelected: true,
|
||||
columns: [
|
||||
[
|
||||
//{checkbox: true},
|
||||
{checkbox: true},
|
||||
{ field: 'id', title: __('回访单号') },
|
||||
//{ field: 'type_id', title: __('Type_id') },
|
||||
{ field: 'type_text', title: __('Type_id'), operate: false },
|
||||
//{field: 'type_id', title: __('Type_id'),visible:false,searchList: $.getJSON("user4s/visittype/searchlist")},
|
||||
{ field: 'user4s_id', title: __('会员ID'),visible:false,operate:false},
|
||||
{ field: 'user.name', title: __('会员姓名'), operate: 'LIKE' },
|
||||
{ field: 'user.tel', title: __('联系方式'), operate: 'LIKE' },
|
||||
{ field: 'user.cardid', title: __('身份证号'), operate: false,visible:false },
|
||||
{field: 'user.carno', title: __('User.carno'), operate: 'LIKE'},
|
||||
//{ field: 'user.buydate', title: __('User.buydate'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false },
|
||||
{field: 'user.model', title: __('User.model'), operate: false},
|
||||
@ -46,7 +49,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
{field: 'visittime', title: __('Visittime'), operate:'BETWEEN', addclass:'datetimepicker',data:'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete:false, formatter: Table.api.formatter.datetime,datetimeFormat:'YYYY-MM-DD'},
|
||||
//{field: 'admin.nickname', title: __('操作员'), operate: 'LIKE'},
|
||||
{ field: 'createtime', title: __('开单时间'), operate: 'BETWEEN', addclass: 'datetimepicker',data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"',datetimeFormat:'YYYY-MM-DD', autocomplete: false, formatter: Table.api.formatter.datetime },
|
||||
{field: 'description', title: __('Description'), operate:false,editable:true},
|
||||
{field: 'description', title: __('Description'), operate:false},
|
||||
{ field: 'status', title: __('Status'), operate: '=',searchList: { "0": __('进行中'), "1": __('已办结') }, formatter: Table.api.formatter.status },
|
||||
//{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
{
|
||||
@ -210,6 +213,56 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
}
|
||||
Fast.api.open(url, $(this).data("original-title") || $(this).attr("title") || __('Add'), $(this).data() || {});
|
||||
});
|
||||
$(document).on("click", ".btn-sms", function () {
|
||||
var select_data = Table.api.selecteddata(table);
|
||||
if (select_data == '') {
|
||||
return false;
|
||||
} else {
|
||||
var ids = [];
|
||||
select_data.forEach((item, index, arr) => {
|
||||
ids.push(item.user4s_id);
|
||||
})
|
||||
}
|
||||
//var ids = Table.api.selectedids(table);
|
||||
var title = $(this).data("original-title") || $(this).attr("title");
|
||||
var url = $.fn.bootstrapTable.defaults.extend.sms_url+'?ids='+ids.join(',');
|
||||
var options = {
|
||||
shadeclose: false,
|
||||
area: $(this).data("data-area"),
|
||||
title: title,
|
||||
callback:function(data){
|
||||
console.log(data);
|
||||
|
||||
}
|
||||
};
|
||||
//Fast.api.open(url, '发送短信');
|
||||
Fast.api.open(url,title ,options);
|
||||
});
|
||||
},
|
||||
sms: function(){
|
||||
Form.api.bindevent($("form[role=form]"), function (data, ret) {
|
||||
console.log('OK', data);
|
||||
if (data.success == data.total) {
|
||||
Fast.api.close(data);//这里是重点
|
||||
return true;
|
||||
} else {
|
||||
$("#sms_status").html('');
|
||||
data.status.forEach((item, index, arr) => {
|
||||
var html = $("#sms_status").html();
|
||||
if (item.code == 0) {
|
||||
html = html + '<span class="label label-warning" style="margin-right: 0.2em;">'+item.name+'('+item.msg+')</span>';
|
||||
} else {
|
||||
html = html + '<span class="label label-info" style="margin-right: 0.2em;">' + item.name + '(' + item.msg + ')</span>';
|
||||
}
|
||||
|
||||
$("#sms_status").html(html);
|
||||
return false;
|
||||
})
|
||||
}
|
||||
}, function (data, ret) {
|
||||
console.log('error',data);
|
||||
Fast.api.close(data);
|
||||
});
|
||||
},
|
||||
recyclebin: function () {
|
||||
// 初始化表格参数配置
|
||||
@ -338,7 +391,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
|
||||
// { field: 'user.model', title: __('车型'), operate: false },
|
||||
// { field: 'user.color', title: __('颜色'), operate: false },
|
||||
{field: 'star_f', title: __('满意度'), operate: false},
|
||||
{field: 'description', title: __('Description'), operate: false,editable:true},
|
||||
{field: 'description', title: __('Description'), operate: false},
|
||||
{
|
||||
field: 'visit_time', title: __('回访时间'), operate: 'BETWEEN', addclass: 'datetimepicker', data: 'data-date-format="YYYY-MM-DD",data-date-use-current="true"', autocomplete: false, formatter: Table.api.formatter.datetime, datetimeFormat: 'YYYY-MM-DD'
|
||||
},
|
||||
|
@ -0,0 +1,6 @@
|
||||
location / {
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^(.*)$ /index.php?s=/$1 last;
|
||||
break;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user