|
@@ -3,6 +3,7 @@
|
|
|
namespace app\controller\api;
|
|
namespace app\controller\api;
|
|
|
|
|
|
|
|
use app\extra\basic\Base;
|
|
use app\extra\basic\Base;
|
|
|
|
|
+use app\extra\dyLife\data\OrderData;
|
|
|
use app\extra\dyLife\Token;
|
|
use app\extra\dyLife\Token;
|
|
|
use app\extra\dyMini\Relation;
|
|
use app\extra\dyMini\Relation;
|
|
|
use app\extra\tools\CodeExtend;
|
|
use app\extra\tools\CodeExtend;
|
|
@@ -166,16 +167,28 @@ class Solution extends Base
|
|
|
{
|
|
{
|
|
|
try {
|
|
try {
|
|
|
// $data = (new Relation)->config($this->getDyConfig())->token()->createOrderFirst(['1865253598118939']);
|
|
// $data = (new Relation)->config($this->getDyConfig())->token()->createOrderFirst(['1865253598118939']);
|
|
|
- $data = (new SaasOrderVerify)->where("status",0)->with(['orders'])->select();
|
|
|
|
|
|
|
+ $data = (new SaasOrder)->where('status',2)->whereNull("douyin_uid")->select();
|
|
|
|
|
+// $data = (new SaasOrderVerify)->where("status",0)->with(['orders'])->select();
|
|
|
if ($data->isEmpty()) return error("err");
|
|
if ($data->isEmpty()) return error("err");
|
|
|
- $upData = array_map(function ($val) {
|
|
|
|
|
- return [
|
|
|
|
|
- "id" => $val['id'],
|
|
|
|
|
- "money" => $val['orders']['price'] / $val['orders']['number']
|
|
|
|
|
- ];
|
|
|
|
|
- }, $data->toArray());
|
|
|
|
|
- (new SaasOrderVerify)->saveAll($upData);
|
|
|
|
|
- return success("ok",$upData);
|
|
|
|
|
|
|
+ $upData = [];
|
|
|
|
|
+ foreach ($data as $key=>$item) {
|
|
|
|
|
+ // 查询订单详情
|
|
|
|
|
+ $orderData = (new OrderData)->config([
|
|
|
|
|
+ "appid" => sConf("wechat.appid"),
|
|
|
|
|
+ "secret" => sConf("wechat.secret"),
|
|
|
|
|
+ "account" => sConf("wechat.shop_id"),
|
|
|
|
|
+ ])->token()->getOrderData($item['order_sn']);
|
|
|
|
|
+ if (isset($orderData['orders'][0]['anchor_id'])) {
|
|
|
|
|
+ $upData[$key] = [
|
|
|
|
|
+ "douyin_uid" => $orderData['orders'][0]['anchor_id'],
|
|
|
|
|
+ "id" => $item['id']
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!empty($upData)) {
|
|
|
|
|
+ (new SaasOrder)->saveAll(array_values($upData));
|
|
|
|
|
+ }
|
|
|
|
|
+ return success("ok",array_values($upData));
|
|
|
} catch (\Throwable $throwable) {
|
|
} catch (\Throwable $throwable) {
|
|
|
return error($throwable->getMessage());
|
|
return error($throwable->getMessage());
|
|
|
}
|
|
}
|