|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
+use app\admin\model\store\StoreProductAttrValue;
|
|
|
use app\admin\model\system\SystemAttachment;
|
|
|
use app\models\store\StoreCategory;
|
|
|
use app\models\store\StoreCouponIssue;
|
|
@@ -13,6 +14,7 @@ use app\models\system\Express;
|
|
|
use app\models\system\SystemCity;
|
|
|
use app\models\system\SystemStore;
|
|
|
use app\models\system\SystemStoreStaff;
|
|
|
+use app\models\system\SystemStoreStock;
|
|
|
use app\models\user\User;
|
|
|
use app\models\user\UserBill;
|
|
|
use app\models\user\WechatUser;
|
|
@@ -34,11 +36,27 @@ class PublicController
|
|
|
|
|
|
public function test()
|
|
|
{
|
|
|
- if (StoreOrder::yuePay('wx164863507069927271', 120))
|
|
|
- return app('json')->status('success', '余额支付成功');
|
|
|
- else {
|
|
|
- $error = StoreOrder::getErrorInfo();
|
|
|
- return app('json')->fail(is_array($error) && isset($error['msg']) ? $error['msg'] : $error);
|
|
|
+ $list = StoreProductAttrValue::where('type', 0)->select();
|
|
|
+ foreach ($list as $v) {
|
|
|
+ $info = SystemStoreStock::where('store_id', 1)->where('unique', $v['unique'])->find();
|
|
|
+ if ($info) {
|
|
|
+ $info->in_stock = $v['stock'];
|
|
|
+ $info->save();
|
|
|
+ } else {
|
|
|
+ SystemStoreStock::create([
|
|
|
+ 'store_id' => 1,
|
|
|
+ 'product_id' => $v['product_id'],
|
|
|
+ 'in_stock' => $v['stock'],
|
|
|
+ 'store_sales' => 0,
|
|
|
+ 'repair_sales' => 0,
|
|
|
+ 'in_last_time' => 0,
|
|
|
+ 'unique' => $v['unique'],
|
|
|
+ 'bar_code' => $v['bar_code'],
|
|
|
+ 'price' => $v['price'],
|
|
|
+ 'image' => $v['image'],
|
|
|
+ 'is_consumer' => StoreProduct::where('id', $v['product_id'])->value('is_consumer'),
|
|
|
+ ]);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|