|
|
@@ -30,6 +30,28 @@ class ProductController extends BaseController
|
|
|
//修改预售 ssh 20221214
|
|
|
public function actionChangePresell()
|
|
|
{
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ $id = $post['id'] ?? 0;
|
|
|
+ $info = ProductClass::getById($id, true);
|
|
|
+ ProductClass::check($info, $this->mainId);
|
|
|
+ $str = $post['date'] ?? '';
|
|
|
+ $presell = $post['presell'] ?? 0;
|
|
|
+ if (empty($string)) {
|
|
|
+ util::fail('请填写预售日期');
|
|
|
+ }
|
|
|
+ $arr = json_decode($str, true);
|
|
|
+ if (empty($arr)) {
|
|
|
+ util::fail('请填写预售日期');
|
|
|
+ }
|
|
|
+ $new = [];
|
|
|
+ foreach ($arr as $date) {
|
|
|
+ $new[] = strtotime($date);
|
|
|
+ }
|
|
|
+ asort($new);
|
|
|
+ $newStr = implode(',', $new);
|
|
|
+ $info->presell = $presell;
|
|
|
+ $info->presellDate = $newStr;
|
|
|
+ $info->save();
|
|
|
util::complete();
|
|
|
}
|
|
|
|