| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace addons\ScoreMall;
- use Yii;
- use yii\db\Migration;
- use common\helpers\MigrateHelper;
- use common\interfaces\AddonWidget;
- use common\enums\StatusEnum;
- use common\models\common\AddonsMarketingSetting;
- /**
- * 安装
- *
- * Class Install
- * @package addons\ScoreMall
- */
- class Install extends Migration implements AddonWidget
- {
- /**
- * @param $addon
- * @return mixed|void
- * @throws \yii\base\InvalidConfigException
- * @throws \yii\web\NotFoundHttpException
- * @throws \yii\web\UnprocessableEntityHttpException
- */
- public function run($addon)
- {
- // MigrateHelper::upByPath([
- // '@addons/ScoreMall/console/migrations/'
- // ]);
- }
- public function runApp($mall_id, $addons_name){
- $setting = '[{"id":"f4f07e01-b6a8-4a1d-8ee7-ed2e52894888","data":{"backSrc":"","contentType":"1","isShowName":"1","logoSrc":"","mainPage":{"defColor":"#fff","name":"积分商城","type":"纯色","imgUrl":""},"name":"积分商城","positionChoose":"1","hideSearch":false},"computedStyle":{"mode":1,"style":1,"titleSwitch":true,"titleMode":1,"imageUrl":[],"position":1,"searchSwitch":true,"searchBgColor":"","statusBarColor":"#FFF","defaultForm":{"defColor":"transparer"},"titleDistance":{"fontSize":16,"height":30,"width":57,"marginLeft":20},"statusBar":"1","searchMarPad":{"marginLeft":20,"paddingLeft":14}},"funcListItem":{"type":"nav","title":"顶部导航","is_top":1},"isShow":true,"is_show_permission":false,"is_drag":false,"disabled":true,"is_delete":false,"is_up":false,"is_down":false,"is_copy":false},{"id":"cd761603-d212-48de-8bdd-f12a49df6443","data":{"buttonData":{"typeIndex":0,"typeItem":null},"buttonPointData":{"open":true,"pointIndex":1,"pointItem":{"label":"resources/img/decorate/point-two.png","value":"two"},"position":1},"carouselImgArr":[{"hotZone":[],"imgUrl":"https://shuzixiangdao.oss-cn-guangzhou.aliyuncs.com/images/2022/01/18/image_1642474529_FABRxfuH.jpg","url":"","urlName":"","urlType":"","visible":false}],"spaceInfo":[{"disabled":false,"hidden":true,"maxValue":20,"name":"图片间距","unit":"px","value":5},{"disabled":false,"hidden":false,"maxValue":50,"name":"上边距","unit":"px","value":0},{"disabled":false,"hidden":false,"maxValue":50,"name":"下边距","unit":"px","value":0},{"disabled":false,"hidden":false,"maxValue":50,"name":"左右边距","unit":"px","value":12}]},"computedStyle":{"searchBox":"","spaceStyle":{"marginTop":"0px","marginBottom":"0px","marginLeft":"12px","marginRight":"12px","height":"160px"},"searchIpts":{"border-bottom-left-radius":"10px","border-bottom-right-radius":"10px","border-top-left-radius":"10px","border-top-right-radius":"10px"},"carouselImgArr":[null]},"permission":[],"funcListItem":{"is_top":0,"title":"轮播广告","type":"carousel-img"},"isShow":true,"is_show_permission":false,"is_drag":false,"disabled":true,"is_delete":false,"is_up":false,"is_down":false,"is_copy":false},{"id":"0f5033c7-5f08-41c5-bef9-2da69a2f41bb","data":{"buttonData":{"line_num":1,"pattern":"fixed","patternItem":null,"shape":"square","single_line":3,"style":1,"type":1},"colorInfos":[{"color":"","name":"底部背景","showAlpha":false,"value":"transparent"},{"color":"","name":"组件背景","showAlpha":false,"value":"transparent"},{"color":"#333333","name":"文字颜色","showAlpha":false,"value":"#333333"}],"iconList":[{"img":"https://shuzixiangdao.oss-cn-guangzhou.aliyuncs.com/images/2022/01/18/image_1642476398_QkKh000y.jpg","icon":"el-icon-setting","is_show_tag":true,"tags":"热门","tagsBgColor":"#f83287","tagsTextColor":"#ffffff","btnText":"积分标题","link_params":{"title":"100积分区","open_type":"page","navigate":"navigateTo","route":"/plugins/score_mall/cateList?cate_id=8","params":{"id":8,"name":"100积分区","status":0,"created_at":1642474650,"title":"100积分区","open_type":"page","route":"/plugins/score_mall/cateList?cate_id=8"}}}],"sizeInfos":[{"disabled":false,"hidden":false,"maxValue":50,"name":"上边距","unit":"px","value":8},{"disabled":false,"hidden":false,"maxValue":50,"name":"下边距","unit":"px","value":8},{"disabled":false,"hidden":false,"maxValue":50,"name":"左右边距","unit":"px","value":0}],"defaultTabs":[{"name":"marketing","children":["score_mall_cate"]}]},"computedStyle":{"iptBg":"","searchBox":"","searchIpts":{"marginBottom":"8px","marginLeft":"0px","marginRight":"0px","marginTop":"8px"},"textStyle":"#333333"},"permission":[],"funcListItem":{"is_top":0,"title":"按钮组","type":"button-group"},"isShow":true,"is_show_permission":false,"is_drag":false,"disabled":true,"is_delete":false,"is_up":false,"is_down":false,"is_copy":false},{"id":"ac9b9c21-b9ff-475e-bcd7-bb83aa496b08","data":{"listType":1,"listShow":true,"dataType":1,"colorInfos":[{"name":"底部颜色","color":"","showAlpha":false,"value":"transparent"},{"name":"组件颜色","color":"#FFFFFF","showAlpha":false,"value":"#FFFFFF"}],"sizeInfos":[{"disabled":false,"hidden":false,"maxValue":20,"name":"图片间距","unit":"px","value":12},{"disabled":false,"hidden":false,"maxValue":50,"name":"上边距","unit":"px","value":7},{"disabled":false,"hidden":false,"maxValue":50,"name":"下边距","unit":"px","value":12},{"disabled":false,"hidden":false,"maxValue":50,"name":"左右边距","unit":"px","value":12},{"disabled":false,"hidden":false,"maxValue":20,"name":"内边距","unit":"px","value":9}]},"computedStyle":{"searchBox":"","iptBg":"#FFFFFF","btnBackground":"#db0505","btnTextColor":"#fff","sizeInfos":{"marginBottom":"12px","marginTop":"7px","aroundMargin":"12px","spacing":"12px","padding":"9px"},"tabItem":{"label":"描边","value":"border","is_show":true,"color":"#DDDDDD"},"searchIpts":{"border-top-left-radius":"10px","border-top-right-radius":"10px","border-bottom-right-radius":"10px","border-bottom-left-radius":"10px"}},"permission":[],"funcListItem":{"is_top":0,"title":"商品列表","type":"score-list"},"isShow":true,"is_show_permission":false,"is_drag":false,"disabled":true,"is_delete":false,"is_up":false,"is_down":false,"is_copy":false}]';
- $count = AddonsMarketingSetting::count(['where' => [['=', 'addons_name', $addons_name], ['=', 'mall_id', $mall_id], ['=', 'status', StatusEnum::ENABLED]]]);
- if ($count <= 0) {
- $model = new AddonsMarketingSetting();
- $model->mall_id = $mall_id;
- $model->addons_name = $addons_name;
- $model->content = $setting;
- $model->save();
- }
- }
- }
|