# 惠充api **Repository Path**: liaosp/huichong-api ## Basic Information - **Project Name**: 惠充api - **Description**: thinkphp 惠充的api - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-11-29 - **Last Updated**: 2024-05-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README > 运行环境要求PHP7.1+,兼容PHP8.0。 目录 ======================== * [权益CPS](docs/coupon.md) * [统一自营订单](docs/union/Order.md) * [供应商管理](docs/basesupplier.md) * [美团分销联盟开发](docs/meituanpub.md) * [饿了么外卖](docs\ele\ele.md) * [美团外卖](docs\meituan/waimai.md) * [聚推客周边游](docs/around/jutuikeAround.md) * [命令管理](app/command/readme.md) [活动供应商需要在index方法加类型](app\admin\controller\BaseSupplier.php) # 更新日志 | 日期 | 内容 | | ---- | ---- | | | | | | | | 2023年3月1日 | [代码SupplierFailGoBack](app/common/service/finance/FinanceScene/SupplierFailGoBack.php) -----[已结算订单供应商失效处理方案](docs/已结算订单供应商失效处理方案.md) | ####权限相关 * [代理后台菜单权限](app\agent\controller\User.php) * [金融相关](app\admin\controller\Finance.php) 记得代理端也要配类型 ####对接有美 [对接有美生活](docs\ymsh\index.md) ##订单 [cps订单生成入口](app\common\service\order\CouponSyncOrderService.php) ## 快站 >在docs/kuaizhan 目录下有相应的申请材料 ## 话费 [流程图](docs/话费/流程图.puml) ###### [定时任务触发](shell/prod/1min.sh) ###### [命令控制器](app/task/command/mobile/CreateSupplierOrder.php)根据supplierCode去找相应的供应商获取配置信息, ` $class = '\\api\\mobile\\' . ucfirst($code);` 查找相应的类进行触发方法`create` ###### 处理类 返回的格式 为数组的形式 `return compact('status', 'supplier_order_no', 'remark');` ###### 后台配置 url : 问下客服 app_id: 问下客服 app_secret: 问下客服 供应商代码:jing36 订单状态走向 | 状态 | 说明 | | ---- | ---- | | status | 月份代理统计 | | 99 | 订单进入轮训状态 | | agent_merchant_stat_item | 月份代理统计 | | agent_merchant_withdraw | 提现记录 | | agent_merchant_withdraw_item | 提现记录明细 | ==================== #### 更新模型与数据库同步 `` php think model:annotation `` ## 惠充目前存在的问题: * 退款申请后,会莫名其妙的状态改成已撤销 (4) ![1654503995(1).png](https://inews.gtimg.com/newsapp_ls/0/14977528049/0.jiketuchuang.png) #### shell定时脚本 - 测试环境 ``` * * * * * sudo -u www /www/wwwroot/api/shell/dev/1min.sh >> /dev/null 2>&1 ``` - 正式环境 ``` * * * * * sudo -u www /www/wwwroot/api/shell/prod/1min.sh >> /dev/null 2>&1 ``` #### think-cron 计划任务 ``` * * * * * sudo -uwww php /www/wwwroot/api/think cron:run >> /www/wwwroot/api/runtime/log/`date +'%Y-%m-%d'`.log 2>&1 ``` ## 外卖拉取之后不会更新状态需要手动更新 [前端判断是否更新状态](app\agent\model\order\Takeout.php) 第120行 [前端再请求后端说需要更新哪一条数据](app\agent\controller\order\Takeout.php) updateOrder() 同步数据: #### Nginx 配置 ``` location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; break; } } location /agent { try_files $uri $uri/ /agent/index.html; } location /admin { try_files $uri $uri/ /admin/index.html; } location /h5 { try_files $uri $uri/ /h5/index.html; } ``` ## 小技巧 子查询: ``` //子查询 //方法一 buildSql $res = Db::name('sex')->field('uid')->where('sex', '男')->buildSql(true); $res = Db::name('user')->where('id', 'exp', 'IN'.$res)->select(); //方法二 function $res = Db::name('user')->where('id', 'in', function($sql){ $sql->name('sex')->field('uid')->where('sex', '男'); })->select(); ``` 闭包查询: ``` $this->where(function ($query) { $query->where('id', 1)->whereor('id', 2); })->find(); ``` ## 框架的坑 * ![img.png](docs/images/img.png) * ![img_1.png](docs/images/img_1.png) * 1.表设计的时候,里面尽量不要使用name这个字段名称,不然在获取这个字段值的时候会跟模型里面的name混淆,使用对象的方式或者name,获取到的是模型名称 * 2.在模型内部获取数据的话,需要改成、 $user = $this->find(1); echo $user->getAttr('create_time'); echo $user->getAttr('name');