代码提交
This commit is contained in:
@@ -73,7 +73,7 @@ class FollowUpController extends BaseController
|
||||
if (empty($title) || empty($reminderTime) || empty($description) || empty($friendId)){
|
||||
return ResponseHelper::error('参数缺失');
|
||||
}
|
||||
$friend = Db::name('wechat_friendship')->where(['id' => $friendId,'companyId' => $companyId])->find();
|
||||
$friend = Db::name('wechat_friendship')->where(['id' => $friendId])->find();
|
||||
if (empty($friend)) {
|
||||
return ResponseHelper::error('好友不存在');
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class ToDoController extends BaseController
|
||||
if (empty($title) || empty($reminderTime) || empty($description) || empty($friendId)){
|
||||
return ResponseHelper::error('参数缺失');
|
||||
}
|
||||
$friend = Db::name('wechat_friendship')->where(['id' => $friendId,'companyId' => $companyId])->find();
|
||||
$friend = Db::name('wechat_friendship')->where(['id' => $friendId])->find();
|
||||
if (empty($friend)) {
|
||||
return ResponseHelper::error('好友不存在');
|
||||
}
|
||||
|
||||
@@ -157,8 +157,9 @@ Route::group('v1/frontend', function () {
|
||||
Route::group('business/poster', function () {
|
||||
Route::post('getone', 'app\cunkebao\controller\plan\PosterWeChatMiniProgram@getPosterTaskData');
|
||||
Route::post('decryptphone', 'app\cunkebao\controller\plan\PosterWeChatMiniProgram@getPhoneNumber');
|
||||
Route::post('decryptphones', 'app\cunkebao\controller\plan\PosterWeChatMiniProgram@decryptphones');
|
||||
//Route::post('decryptphones', 'app\cunkebao\controller\plan\PosterWeChatMiniProgram@decryptphones');
|
||||
});
|
||||
Route::post('business/form/importsave', 'app\cunkebao\controller\plan\PosterWeChatMiniProgram@decryptphones');
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -5,9 +5,11 @@ namespace app\cunkebao\controller\plan;
|
||||
use think\Controller;
|
||||
use think\Request;
|
||||
use EasyWeChat\Factory;
|
||||
|
||||
// use EasyWeChat\Kernel\Exceptions\DecryptException;
|
||||
use EasyWeChat\Kernel\Http\StreamResponse;
|
||||
use think\Db;
|
||||
|
||||
class PosterWeChatMiniProgram extends Controller
|
||||
{
|
||||
public function index()
|
||||
@@ -16,19 +18,20 @@ class PosterWeChatMiniProgram extends Controller
|
||||
}
|
||||
|
||||
const MINI_PROGRAM_CONFIG = [
|
||||
'app_id' => 'wx789850448e26c91d',
|
||||
'app_id' => 'wx789850448e26c91d',
|
||||
'secret' => 'd18f75b3a3623cb40da05648b08365a1',
|
||||
'response_type' => 'array'
|
||||
];
|
||||
|
||||
|
||||
// 生成小程序码,存客宝-操盘手调用
|
||||
public function generateMiniProgramCodeWithScene($taskId = '') {
|
||||
public function generateMiniProgramCodeWithScene($taskId = '')
|
||||
{
|
||||
|
||||
if (empty($taskId)){
|
||||
return json_encode(['code' => 500,'data' => '','msg' => '任务id不能为空']);
|
||||
if (empty($taskId)) {
|
||||
return json_encode(['code' => 500, 'data' => '', 'msg' => '任务id不能为空']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
$app = Factory::miniProgram(self::MINI_PROGRAM_CONFIG);
|
||||
@@ -53,13 +56,14 @@ class PosterWeChatMiniProgram extends Controller
|
||||
$img_base64 = 'data:image/png;base64,' . base64_encode($img);//转化base64
|
||||
return json_encode(['code' => 200, 'data' => $img_base64]);
|
||||
}
|
||||
}catch (\Exception $e) {
|
||||
return json_encode(['code' => 500,'data' => '','msg' => $e->getMessage()]);
|
||||
} catch (\Exception $e) {
|
||||
return json_encode(['code' => 500, 'data' => '', 'msg' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
// getPhoneNumber
|
||||
public function getPhoneNumber() {
|
||||
public function getPhoneNumber()
|
||||
{
|
||||
|
||||
$taskId = request()->param('id');
|
||||
$code = request()->param('code');
|
||||
@@ -124,23 +128,23 @@ class PosterWeChatMiniProgram extends Controller
|
||||
}
|
||||
|
||||
// return $result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function decryptphones() {
|
||||
public function decryptphones()
|
||||
{
|
||||
|
||||
$taskId = request()->param('id');
|
||||
$phone = request()->param('phone');
|
||||
if (!$phone) {
|
||||
$phoneData = request()->param('phone');
|
||||
if (!$phoneData) {
|
||||
return json([
|
||||
'code' => 400,
|
||||
'message' => '手机号不能为空'
|
||||
]);
|
||||
}
|
||||
|
||||
$task = Db::name('customer_acquisition_task')->where('id', $taskId)->find();
|
||||
|
||||
if (!$task) {
|
||||
return json([
|
||||
'code' => 400,
|
||||
@@ -148,10 +152,12 @@ class PosterWeChatMiniProgram extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
if (!empty($phone)) {
|
||||
|
||||
// TODO 拿到手机号之后的后续操作:
|
||||
// 1. 先写入 ck_traffic_pool 表 identifier mobile 都是 用 phone字段的值
|
||||
$phoneData = explode(',', $phoneData);
|
||||
foreach ($phoneData as $phone) {
|
||||
if (empty($phone)) {
|
||||
continue;
|
||||
}
|
||||
$trafficPool = Db::name('traffic_pool')->where('identifier', $phone)->find();
|
||||
if (!$trafficPool) {
|
||||
Db::name('traffic_pool')->insert([
|
||||
@@ -162,7 +168,7 @@ class PosterWeChatMiniProgram extends Controller
|
||||
}
|
||||
|
||||
$taskCustomer = Db::name('task_customer')->where('task_id', $taskId)->where('phone', $phone)->find();
|
||||
if (!$taskCustomer) {
|
||||
if (empty($taskCustomer)) {
|
||||
Db::name('task_customer')->insert([
|
||||
'task_id' => $taskId,
|
||||
// 'identifier' => $phone,
|
||||
@@ -173,32 +179,27 @@ class PosterWeChatMiniProgram extends Controller
|
||||
'siteTags' => json_encode([]),
|
||||
]);
|
||||
}
|
||||
// return $phone;
|
||||
return json([
|
||||
'code' => 200,
|
||||
'message' => '获取手机号成功',
|
||||
'data' => $phone
|
||||
]);
|
||||
} else {
|
||||
// return null;
|
||||
return json([
|
||||
'code' => 400,
|
||||
'message' => '手机号失败:'
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
// return $result;
|
||||
// return $phone;
|
||||
return json([
|
||||
'code' => 200,
|
||||
'message' => '操作成功',
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
// return $result;
|
||||
|
||||
|
||||
|
||||
// todo 获取海报获客任务的任务/海报数据 -- 表还没设计好,不急 ck_customer_acquisition_task
|
||||
public function getPosterTaskData() {
|
||||
// todo 获取海报获客任务的任务/海报数据 -- 表还没设计好,不急 ck_customer_acquisition_task
|
||||
public
|
||||
function getPosterTaskData()
|
||||
{
|
||||
$id = request()->param('id');
|
||||
$task = Db::name('customer_acquisition_task')
|
||||
->where(['id' => $id,'deleteTime' => 0])
|
||||
->where(['id' => $id, 'deleteTime' => 0])
|
||||
->field('id,name,sceneConf,status')
|
||||
->find();
|
||||
if (!$task) {
|
||||
@@ -208,7 +209,7 @@ class PosterWeChatMiniProgram extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
if($task['status'] == 0) {
|
||||
if ($task['status'] == 0) {
|
||||
return json([
|
||||
'code' => 400,
|
||||
'message' => '任务已结束'
|
||||
@@ -217,14 +218,14 @@ class PosterWeChatMiniProgram extends Controller
|
||||
|
||||
$sceneConf = json_decode($task['sceneConf'], true);
|
||||
|
||||
if(isset($sceneConf['posters']['url'])) {
|
||||
if (isset($sceneConf['posters']['url'])) {
|
||||
$posterUrl = !empty($sceneConf['posters']['url']);
|
||||
} else {
|
||||
$posterUrl = 'https://hebbkx1anhila5yf.public.blob.vercel-storage.com/%E7%82%B9%E5%87%BB%E5%92%A8%E8%AF%A2-FTiyAMAPop2g9LvjLOLDz0VwPg3KVu.gif';
|
||||
}
|
||||
|
||||
|
||||
if(isset($sceneConf['tips'])) {
|
||||
if (isset($sceneConf['tips'])) {
|
||||
$sTip = $sceneConf['tips'];
|
||||
} else {
|
||||
$sTip = '';
|
||||
|
||||
@@ -67,6 +67,9 @@
|
||||
# 工作台建群
|
||||
*/5 * * * * cd /www/wwwroot/mckb_quwanzhi_com/Server && php think workbench:groupCreate >> /www/wwwroot/mckb_quwanzhi_com/Server/runtime/log/workbench_groupCreate.log 2>&1
|
||||
|
||||
# 工作台通讯录导入
|
||||
*/5 * * * * cd /www/wwwroot/mckb_quwanzhi_com/Server && php think workbench:import-contact >> /www/wwwroot/mckb_quwanzhi_com/Server/runtime/log/import_contact.log 2>&1
|
||||
|
||||
# 工作台流量分发
|
||||
0 9 * * * cd /www/wwwroot/mckb_quwanzhi_com/Server && php think workbench:trafficDistribute >> /www/wwwroot/mckb_quwanzhi_com/Server/runtime/log/traffic_distribute.log 2>&1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user