修改
This commit is contained in:
parent
222a19a331
commit
995d06ea1d
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace addons\alisms\library;
|
namespace addons\alisms\library;
|
||||||
|
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 阿里大于SMS短信发送
|
* 阿里大于SMS短信发送
|
||||||
*/
|
*/
|
||||||
|
|
@ -91,6 +93,12 @@ class Alisms
|
||||||
{
|
{
|
||||||
$this->error = '';
|
$this->error = '';
|
||||||
$params = $this->_params();
|
$params = $this->_params();
|
||||||
|
Db::name('sms_record')->insert([
|
||||||
|
'receiver' => $params['PhoneNumbers'],
|
||||||
|
'content' => $params['TemplateParam'],
|
||||||
|
'template_id' => $params['TemplateCode'],
|
||||||
|
]);
|
||||||
|
return true;
|
||||||
$params['Signature'] = $this->_signed($params);
|
$params['Signature'] = $this->_signed($params);
|
||||||
$response = $this->_curl($params);
|
$response = $this->_curl($params);
|
||||||
if ($response !== false) {
|
if ($response !== false) {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ namespace app\admin\command;
|
||||||
|
|
||||||
use app\admin\addresmart\Address;
|
use app\admin\addresmart\Address;
|
||||||
use app\admin\controller\orders\DispatchLogic;
|
use app\admin\controller\orders\DispatchLogic;
|
||||||
|
use app\admin\controller\SendMailLogic;
|
||||||
use app\admin\model\Order;
|
use app\admin\model\Order;
|
||||||
use app\admin\model\OrderDispatch;
|
use app\admin\model\OrderDispatch;
|
||||||
use app\admin\model\OrderReview;
|
use app\admin\model\OrderReview;
|
||||||
|
|
@ -31,15 +32,10 @@ class Test extends Command
|
||||||
|
|
||||||
protected function execute(Input $input, Output $output)
|
protected function execute(Input $input, Output $output)
|
||||||
{
|
{
|
||||||
$res = \app\common\library\Sms::notice('17381847364',[], 'start_worker');
|
// $ret = SendMailLogic::sendToCustomStart('13038128325','今日的风儿','173xxxxxxxx');
|
||||||
|
$ret = SendMailLogic::sendToCustomStop('17381847365');
|
||||||
$alisms = new \addons\alisms\library\Alisms();
|
|
||||||
$ret = $alisms->mobile('13038128325')
|
|
||||||
->template('SMS_487375365')
|
|
||||||
->sign('超邦手')
|
|
||||||
->send();
|
|
||||||
|
|
||||||
dd($ret);
|
dd($ret);
|
||||||
|
// dd($ret);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ class Order extends Backend
|
||||||
parent::_initialize();
|
parent::_initialize();
|
||||||
$this->model = new \app\admin\model\Order;
|
$this->model = new \app\admin\model\Order;
|
||||||
$this->view->assign("statusList", $this->model->getStatusList());
|
$this->view->assign("statusList", $this->model->getStatusList());
|
||||||
|
|
||||||
$sources = Db::name('source')
|
$sources = Db::name('source')
|
||||||
->where('status', 1)
|
->where('status', 1)
|
||||||
->field(['id', 'title', 'key_word', 'pid'])
|
->field(['id', 'title', 'key_word', 'pid'])
|
||||||
|
|
@ -485,7 +484,8 @@ class Order extends Backend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function addAbnormal($ids = null){
|
public function addAbnormal($ids = null)
|
||||||
|
{
|
||||||
if (false === $this->request->isPost()) {
|
if (false === $this->request->isPost()) {
|
||||||
|
|
||||||
$abnormals = model('abnormal')->where('type', 1)->order('sort', 'desc')->select();
|
$abnormals = model('abnormal')->where('type', 1)->order('sort', 'desc')->select();
|
||||||
|
|
@ -540,7 +540,8 @@ class Order extends Backend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function delete($ids = null){
|
public function delete($ids = null)
|
||||||
|
{
|
||||||
if (false === $this->request->isPost()) {
|
if (false === $this->request->isPost()) {
|
||||||
|
|
||||||
$options = \model('abnormal')->where('type', 2)->select();
|
$options = \model('abnormal')->where('type', 2)->select();
|
||||||
|
|
@ -557,42 +558,53 @@ class Order extends Backend
|
||||||
}
|
}
|
||||||
$params = $this->preExcludeFields($params);
|
$params = $this->preExcludeFields($params);
|
||||||
|
|
||||||
|
$send_mail = $params['notify'] ?? false;
|
||||||
|
|
||||||
$result = false;
|
$result = false;
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
|
||||||
$order = model('order')->get($params['order_id'], ['dispatch']);
|
$order = model('order')->get($params['order_id'], ['dispatch']);
|
||||||
if (!$order) {
|
if (!$order) {
|
||||||
$this->error('Not Find');
|
$this->error('Not Find');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
$params['status'] = \app\admin\model\Order::STATUS_CANCEL;
|
$params['status'] = \app\admin\model\Order::STATUS_CANCEL;
|
||||||
|
|
||||||
|
unset($params['notify']);
|
||||||
|
|
||||||
$result = $order->allowField(true)->save($params);
|
$result = $order->allowField(true)->save($params);
|
||||||
|
|
||||||
if(!empty($order->dispatch)){
|
if (!empty($order->dispatch->id)) {
|
||||||
$orderLogic = new OrderLogic();
|
$orderLogic = new OrderLogic();
|
||||||
$orderLogic->cancelOrderDispatch($order->dispatch, $this->auth, '订单被取消', false);
|
$orderLogic->cancelOrderDispatch($order->dispatch, $this->auth, '订单被取消', false);
|
||||||
}
|
|
||||||
|
|
||||||
//日志
|
//日志
|
||||||
$hookparams['order'] = $order;
|
$hookparams['order'] = $order;
|
||||||
$hookparams['role'] = 1;
|
$hookparams['role'] = 1;
|
||||||
$hookparams['auth'] = $this->auth;
|
$hookparams['auth'] = $this->auth;
|
||||||
$hookparams['remark'] = $params['remark'] ?? '';
|
$hookparams['remark'] = $params['remark'] ?? '';
|
||||||
Hook::listen('order_change', $hookparams);
|
Hook::listen('order_change', $hookparams);
|
||||||
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (ValidateException | PDOException | Exception $e) {
|
} catch (ValidateException | PDOException | Exception $e) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
$this->error(__('No rows were inserted'));
|
$this->error(__('No rows were inserted'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($send_mail) {
|
||||||
|
SendMailLogic::sendToCustomStop($order->tel);
|
||||||
|
}
|
||||||
|
|
||||||
$this->success();
|
$this->success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function send($ids = null){
|
public function send($ids = null)
|
||||||
|
{
|
||||||
if (false === $this->request->isPost()) {
|
if (false === $this->request->isPost()) {
|
||||||
|
|
||||||
$options = \model('admin')->select();
|
$options = \model('admin')->select();
|
||||||
|
|
@ -660,6 +672,7 @@ class Order extends Backend
|
||||||
// 重新索引数组
|
// 重新索引数组
|
||||||
return array_values($filtered_codes);
|
return array_values($filtered_codes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
*
|
*
|
||||||
|
|
@ -668,7 +681,8 @@ class Order extends Backend
|
||||||
* @throws DbException
|
* @throws DbException
|
||||||
* @throws \think\Exception
|
* @throws \think\Exception
|
||||||
*/
|
*/
|
||||||
public function invoice($ids = null){
|
public function invoice($ids = null)
|
||||||
|
{
|
||||||
if (false === $this->request->isPost()) {
|
if (false === $this->request->isPost()) {
|
||||||
$order = model('order')->get($ids);
|
$order = model('order')->get($ids);
|
||||||
return $this->fetch('order/invoice/add', ['row' => $order]);
|
return $this->fetch('order/invoice/add', ['row' => $order]);
|
||||||
|
|
@ -698,7 +712,8 @@ class Order extends Backend
|
||||||
$this->success();
|
$this->success();
|
||||||
}
|
}
|
||||||
|
|
||||||
function findElementByValue($data, $targetValue, $path = []) {
|
function findElementByValue($data, $targetValue, $path = [])
|
||||||
|
{
|
||||||
foreach ($data as $item) {
|
foreach ($data as $item) {
|
||||||
// 将当前节点的 label 添加到路径中
|
// 将当前节点的 label 添加到路径中
|
||||||
$newPath = array_merge($path, [$item['label']]);
|
$newPath = array_merge($path, [$item['label']]);
|
||||||
|
|
|
||||||
73
application/admin/controller/SendMailLogic.php
Normal file
73
application/admin/controller/SendMailLogic.php
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
|
class SendMailLogic
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给工人发送开始前短信
|
||||||
|
* @param $tel
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendToWorker($toTel)
|
||||||
|
{
|
||||||
|
$config = get_addon_config('alisms');
|
||||||
|
if (!isset($config['template']['start_worker'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$alisms = new \addons\alisms\library\Alisms();
|
||||||
|
$result = $alisms->mobile($toTel)
|
||||||
|
->template($config['template']['start_worker'])
|
||||||
|
->param([])
|
||||||
|
->send();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给客户接单的信息
|
||||||
|
* @param $tel
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendToCustomStart($toTel,$work_name,$work_tel)
|
||||||
|
{
|
||||||
|
$config = get_addon_config('alisms');
|
||||||
|
if (!isset($config['template']['start_custom'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$alisms = new \addons\alisms\library\Alisms();
|
||||||
|
$result = $alisms->mobile($toTel)
|
||||||
|
->template($config['template']['start_custom'])
|
||||||
|
->param([
|
||||||
|
'name' => $work_name,
|
||||||
|
'phone' => $work_tel
|
||||||
|
])
|
||||||
|
->send();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给客户取消订单的信息
|
||||||
|
* @param $tel
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendToCustomStop($toTel)
|
||||||
|
{
|
||||||
|
$config = get_addon_config('alisms');
|
||||||
|
if (!isset($config['template']['stop_custom'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$alisms = new \addons\alisms\library\Alisms();
|
||||||
|
$result = $alisms->mobile($toTel)
|
||||||
|
->template($config['template']['stop_custom'])
|
||||||
|
->param()
|
||||||
|
->send();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -175,12 +175,13 @@ class Aftersale extends Backend
|
||||||
Message::create([
|
Message::create([
|
||||||
'to_id' => $params['dispatch_admin_id'],
|
'to_id' => $params['dispatch_admin_id'],
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
'title' => '订单报错通知',
|
'title' => '售后申请通知',
|
||||||
'content' => '【售后申请通知】您有一条售后申请待处理,请前往订单售后界面进行处理!'
|
'content' => '【售后申请通知】您有一条售后申请待处理,请前往订单售后界面进行处理!'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$result = $this->model->allowField(true)->save($params);
|
$result = $this->model->allowField(true)->save($params);
|
||||||
$order->aftersale_id = $this->model->id;
|
$order->aftersale_id = $this->model->id;
|
||||||
|
$order->status = Order::STATUS_AFTERSALE;
|
||||||
$order->save();
|
$order->save();
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (ValidateException|PDOException|Exception $e) {
|
} catch (ValidateException|PDOException|Exception $e) {
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ return [
|
||||||
'Status 50' => '待结算',
|
'Status 50' => '待结算',
|
||||||
'Set status to 50' => '设为待结算',
|
'Set status to 50' => '设为待结算',
|
||||||
'Status 60' => '已完成',
|
'Status 60' => '已完成',
|
||||||
|
'Status 70' => '售后',
|
||||||
'Set status to 60' => '设为已完成',
|
'Set status to 60' => '设为已完成',
|
||||||
'Status -10' => '取消',
|
'Status -10' => '取消',
|
||||||
'Set status to -10' => '设为取消',
|
'Set status to -10' => '设为取消',
|
||||||
|
|
|
||||||
|
|
@ -55,18 +55,23 @@ class Order extends Model
|
||||||
const STATUS_CHECKONCE = 41; //审核未通过
|
const STATUS_CHECKONCE = 41; //审核未通过
|
||||||
const STATUS_AUDITING = 50; //审核中
|
const STATUS_AUDITING = 50; //审核中
|
||||||
const STATUS_FINISHED = 60; //已完成
|
const STATUS_FINISHED = 60; //已完成
|
||||||
|
const STATUS_AFTERSALE= 70; //已完成
|
||||||
const STATUS_CANCEL = -10; //取消
|
const STATUS_CANCEL = -10; //取消
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getStatusList()
|
public function getStatusList()
|
||||||
{
|
{
|
||||||
return ['0' => __('Status 0'),'10' => __('Status 10'), '20' => __('Status 20'),
|
return ['0' => __('Status 0'),'10' => __('Status 10'), '20' => __('Status 20'),
|
||||||
//'30' => __('Status 30'),
|
//'30' => __('Status 30'),
|
||||||
'40' => __('Status 40'),
|
'40' => __('Status 40'),
|
||||||
'41' => __('Status 41'),
|
'41' => __('Status 41'),
|
||||||
'50' => __('Status 50'), '60' => __('Status 60'), '-10' => __('Status -10')];
|
'50' => __('Status 50'),
|
||||||
|
'60' => __('Status 60'),
|
||||||
|
'70' => __('Status 70'),
|
||||||
|
'-10' => __('Status -10')];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -186,6 +191,11 @@ class Order extends Model
|
||||||
return $this->belongsTo(Admin::class,'admin_id',);
|
return $this->belongsTo(Admin::class,'admin_id',);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function admin(){
|
||||||
|
return $this->belongsTo(Admin::class,'admin_id',joinType: 'left')
|
||||||
|
->setEagerlyType(0);
|
||||||
|
}
|
||||||
|
|
||||||
public function item(){
|
public function item(){
|
||||||
return $this->belongsTo(Item::class,'item_id',);
|
return $this->belongsTo(Item::class,'item_id',);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">短信通知客户: <input type="checkbox" name="row[notify]"> </label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group layer-footer">
|
<div class="form-group layer-footer">
|
||||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
"41": __('Status 41'),
|
"41": __('Status 41'),
|
||||||
"50": __('Status 50'),
|
"50": __('Status 50'),
|
||||||
"60": __('Status 60'),
|
"60": __('Status 60'),
|
||||||
|
"70": __('Status 70'),
|
||||||
"-10": __('Status -10'),
|
"-10": __('Status -10'),
|
||||||
/*"-20": __('Status -20'),
|
/*"-20": __('Status -20'),
|
||||||
"-30": __('Status -30')*/
|
"-30": __('Status -30')*/
|
||||||
|
|
@ -199,7 +200,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
extend: 'data-toggle="tooltip" data-container="body"',
|
extend: 'data-toggle="tooltip" data-container="body"',
|
||||||
classname: 'btn btn-xs btn-info btn-editone',
|
classname: 'btn btn-xs btn-info btn-editone',
|
||||||
visible: function (row) {
|
visible: function (row) {
|
||||||
if (row.status != 60) {
|
if (row.status != 60 && row.status != 70) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -299,7 +300,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
visible: function (row) {
|
visible: function (row) {
|
||||||
if (row.status > 0) {
|
if (row.status == 10) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -342,7 +343,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
refresh:true,
|
refresh:true,
|
||||||
dropdown: "更多",
|
dropdown: "更多",
|
||||||
visible: function (row) {
|
visible: function (row) {
|
||||||
if (row.status != 60) {
|
if (row.status != 60 && row.status != 70) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -358,7 +359,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
dropdown: "更多",
|
dropdown: "更多",
|
||||||
|
|
||||||
visible: function (row) {
|
visible: function (row) {
|
||||||
if (row.status == 60) {
|
if (row.status == 60 || row.status == 70) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -373,7 +374,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
url: 'aftersales/aftersale/add',
|
url: 'aftersales/aftersale/add',
|
||||||
dropdown: "更多",
|
dropdown: "更多",
|
||||||
visible: function (row) {
|
visible: function (row) {
|
||||||
if (row.status!==-10) {
|
if (row.status !== -10 && row.status !== 70) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
buttons:[
|
buttons:[
|
||||||
{
|
{
|
||||||
name: 'edit',
|
name: 'edit',
|
||||||
text: "修改",
|
text: "开票",
|
||||||
icon: 'fa fa-pencil',
|
icon: 'fa fa-pencil',
|
||||||
title: __('Edit'),
|
title: __('Edit'),
|
||||||
extend: 'data-toggle="tooltip" data-container="body"',
|
extend: 'data-toggle="tooltip" data-container="body"',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user