| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace ghs\controllers;
- use bizGhs\modify\classes\ModifyClass;
- use bizGhs\modify\classes\ModifyItemClass;
- use Yii;
- use common\components\util;
- class ModifyController extends BaseController
- {
- public $guestAccess = [];
- public function actionList()
- {
- $where = [];
- $where['mainId'] = $this->mainId;
- $respond = ModifyClass::getModifyList($where);
- util::success($respond);
- }
- //添加修改记录 ssh 20240502
- public function actionAdd()
- {
- $post = Yii::$app->request->post();
- $modifyName = $post['modifyName'] ?? '';
- if (empty($modifyName)) {
- $modifyName = date("mdHIs");
- }
- $data = $post['data'] ?? '';
- if (!empty($data)) {
- $arr = json_decode($data, true);
- if (!empty($arr)) {
- $mData = [
- 'name' => $modifyName,
- 'mainId' => $this->mainId,
- 'inTurn' => 100,
- ];
- $info = ModifyClass::add($mData, true);
- $returnId = $info->id ?? 0;
- foreach ($arr as $it) {
- $name = $it['name'] ?? '';
- $cover = $it['cover'] ?? '';
- $productId = $it['id'] ?? 0;
- $skPrice = $it['skPrice'] ?? 0;
- $hjPrice = $it['skPrice'] ?? 0;
- $price = $it['price'] ?? 0;
- $currentData = [
- 'mId' => $returnId,
- 'name' => $name,
- 'productId' => $productId,
- 'skPrice' => $skPrice,
- 'price' => $price,
- 'hjPrice' => $hjPrice,
- 'cover' => $cover,
- ];
- ModifyItemClass::add($currentData, true);
- }
- }
- }
- util::complete();
- }
- }
|