Commit 49ff75e5 authored by hujun's avatar hujun

message

parent 7f923275
......@@ -3,9 +3,9 @@
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\PushMessageService;
use app\api_broker\service\StoreFeeService;
use app\index\service\UserService;
use app\model\AAgents;
use app\model\AStore;
use app\model\FollowUpLogModel;
......@@ -88,6 +88,8 @@ class StoreFee extends Basic
$is_ok = $this->service_->addApplyFor($type, $fee_item, $total_fee, $agent_id, $store_id, $purpose, $site_id, $card_name,
$bank, $card_no, $count_time, $img_arr, 0, $office_id);
if ($is_ok > 0) {
$push = new PushMessageService();
$push->recordApplyForFeDistrict($agent_id, $this->agentId);
return $this->response("200", "request success", []);
} else {
return $this->response("101", "save exception");
......
......@@ -547,4 +547,48 @@ class PushMessageService
$where['site_id'] = $site_id;
return $m_user_agent->getUserAgentColumn('agent_id', $where);
}
/**
* 费用报销推送给总监
*
* @param $agent_id
* @param $operation_id
* @return bool
*/
public function recordApplyForFeDistrict($agent_id, $operation_id)
{
$redis = new RedisCacheService();
$agent_data = $redis->getRedisCache(2, $agent_id);
if ($agent_data) {
return false;
}
$m_agent = new AAgents();
$where['district_id'] = $agent_data['district_id'];
$where['level'] = ['in', '30,40'];
$where['status'] = 0;
$district_id_agent = $m_agent->getFieldOneValue('id', $where);
if (empty($district_id_agent)) {
return false;
}
$record_data['message'] = '[' . $agent_data['name'] . ']提交了费用报销,快去审核吧!';
$this->record(19, 0, [$district_id_agent], $operation_id, $record_data);
return true;
}
/**
* 费用报销审核完推送给提交人
*
* @param $agent_id
* @param $operation_id
* @return bool
*/
public function recordApplyForFeCheck($agent_id, $operation_id)
{
$record_data['message'] = '你有费用报销通过审核通过!';
$this->record(19, 0, [$agent_id], $operation_id, $record_data);
return true;
}
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ namespace app\index\controller;
*/
use app\api_broker\service\PushMessageService;
use app\api_broker\service\RedisCacheService;
use app\api_broker\service\StoreFeeService;
use app\api_broker\validate\StoreFeeValidate;
......@@ -472,6 +473,8 @@ class StoreFee extends Basic
$is_ok = $service_->addApplyForPC($type, $fee_item, $total_fee, $agent_id, $store_id, $purpose, $site_id, $card_name,
$bank, $card_no, $count_time, $img_arr, $id, $office_id, $status);
if ($is_ok > 0) {
$push = new PushMessageService();
$push->recordApplyForFeDistrict($agent_id, $this->userId);
return $this->response("200", "request success", []);
} else {
return $this->response("101", "save exception");
......
......@@ -4,6 +4,7 @@
namespace app\index\service;
use app\api_broker\service\PushMessageService;
use app\model\FApplyForFee;
use app\model\FApplyForFeeCheck;
use app\model\FImg;
......@@ -35,7 +36,7 @@ class CostService
$result['msg'] = '';
$where['id'] = $params['id'];
$where['is_del'] = $is_update_apply = 0;
$cost_data = $this->apply_model->findByOne('id,status', $where);
$cost_data = $this->apply_model->findByOne('id,status,agent_id', $where);
if (empty($cost_data)) {
$result['msg'] = '无该记录';
return $result;
......@@ -79,6 +80,9 @@ class CostService
if (isset($img_arr)) {
$this->f_img_model->insertDataAll($img_arr);
}
$push = new PushMessageService();
$push->recordApplyForFeCheck($cost_data['agent_id'], '', $agent_id);
}
} catch (\Exception $e) {
$result['msg'] = '修改申请记录失败'.$e->getMessage();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment