RechargeModule.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use yii\base\Model;
  9. class RechargeModule extends Model
  10. {
  11. public $store_id;
  12. public function search_recharge()
  13. {
  14. $list = [
  15. 'status' => 0,
  16. 'pic_url' => \Yii::$app->request->hostInfo . \Yii::$app->request->baseUrl . '/statics/images/recharge/icon-balance-bg.png',
  17. 'ad_pic_url' => \Yii::$app->request->hostInfo . \Yii::$app->request->baseUrl . '/statics/images/recharge/icon-balance-ad.png',
  18. 'page_url' => '/pages/recharge/recharge',
  19. 'p_pic_url' => \Yii::$app->request->hostInfo . \Yii::$app->request->baseUrl . '/statics/images/recharge/icon-balance-p.png',
  20. 'help' => '',
  21. 'type' => 0,
  22. ];
  23. $name = [
  24. 'recharge_wallet_status',
  25. 'recharge_custom_status',
  26. 'recharge_pic_url',
  27. 'recharge_ad_pic_url',
  28. 'recharge_page_url',
  29. 'recharge_p_pic_url',
  30. 'recharge_help',
  31. ];
  32. $data = Option::get($name, $this->store_id, 'recharge');
  33. $data = array_column($data, null, 'name');
  34. $data = [
  35. 'status' => $data['recharge_wallet_status']['value'],
  36. 'pic_url' => $data['recharge_pic_url']['value'],
  37. 'ad_pic_url' => $data['recharge_ad_pic_url']['value'],
  38. 'page_url' => $data['recharge_page_url']['value'],
  39. 'p_pic_url' => $data['recharge_p_pic_url']['value'],
  40. 'help' => $data['recharge_help']['value'],
  41. 'type' => $data['recharge_custom_status']['value'],
  42. ];
  43. $new_list = [];
  44. if ($data) {
  45. foreach ($list as $index => $value) {
  46. if (isset($data[$index]) && $data[$index]) {
  47. $new_list[$index] = $data[$index];
  48. } else {
  49. $new_list[$index] = $value;
  50. }
  51. }
  52. } else {
  53. $new_list = $list;
  54. }
  55. return $new_list;
  56. }
  57. }