人人商城

compat.biz.func.php 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. if (isset($_W['uniacid'])) {
  8. $_W['weid'] = $_W['uniacid'];
  9. }
  10. if (isset($_W['openid'])) {
  11. $_W['fans']['from_user'] = $_W['openid'];
  12. }
  13. if (isset($_W['member']['uid'])) {
  14. if (empty($_W['fans']['from_user'])) {
  15. $_W['fans']['from_user'] = $_W['member']['uid'];
  16. }
  17. }
  18. if (!function_exists('fans_search')) {
  19. function fans_search($user, $fields = array()) {
  20. global $_W;
  21. load()->model('mc');
  22. $uid = intval($user);
  23. if(empty($uid)) {
  24. $uid = pdo_fetchcolumn("SELECT uid FROM ".tablename('mc_mapping_fans')." WHERE openid = :openid AND acid = :acid", array(':openid' => $user, ':acid' => $_W['acid']));
  25. if (empty($uid)) {
  26. return array(); }
  27. }
  28. return mc_fetch($uid, $fields);
  29. }
  30. }
  31. if (!function_exists('fans_fields')) {
  32. function fans_fields() {
  33. load()->model('mc');
  34. return mc_fields();
  35. }
  36. }
  37. if(!function_exists('fans_update')) {
  38. function fans_update($user, $fields) {
  39. global $_W;
  40. load()->model('mc');
  41. $uid = intval($user);
  42. if(empty($uid)) {
  43. $uid = pdo_fetchcolumn("SELECT uid FROM ".tablename('mc_mapping_fans')." WHERE openid = :openid AND acid = :acid", array(':openid' => $user, ':acid' => $_W['acid']));
  44. if (empty($uid)) {
  45. return false; }
  46. }
  47. return mc_update($uid, $fields);
  48. }
  49. }
  50. if (!function_exists('create_url')) {
  51. function create_url($segment = '', $params = array(), $noredirect = false) {
  52. return url($segment, $params, $noredirect);
  53. }
  54. }
  55. if (!function_exists('toimage')) {
  56. function toimage($src) {
  57. return tomedia($src);
  58. }
  59. }
  60. if (!function_exists('uni_setting')) {
  61. function uni_setting($uniacid = 0, $fields = '*', $force_update = false) {
  62. global $_W;
  63. load()->model('account');
  64. if ($fields == '*') {
  65. $fields = '';
  66. }
  67. return uni_setting_load($fields, $uniacid);
  68. }
  69. }
  70. if (!function_exists('activity_token_owned')) {
  71. function activity_token_owned($uid, $filter = array(), $pindex = 1, $psize = 10) {
  72. return activity_coupon_owned();
  73. }
  74. }
  75. if (!function_exists('activity_token_info')) {
  76. function activity_token_info($couponid, $uniacid) {
  77. return activity_coupon_info($couponid);
  78. }
  79. }
  80. if (!function_exists('activity_token_grant')) {
  81. function activity_token_grant($uid, $couponid, $module = '', $remark = '') {
  82. return activity_coupon_grant($couponid,$uid);
  83. }
  84. }
  85. if (!function_exists('activity_token_use')) {
  86. function activity_token_use($uid, $couponid, $operator, $clerk_id = 0, $recid = '', $module = 'system', $clerk_type = 1, $store_id = 0) {
  87. return activity_coupon_use($couponid,$recid, $module);
  88. }
  89. }
  90. if (!function_exists('activity_token_available')) {
  91. function activity_token_available($uid, $pindex = 1, $psize = 0) {
  92. return activity_coupon_available();
  93. }
  94. }
  95. if (!function_exists('uni_user_permission')) {
  96. function uni_user_permission($type = 'system') {
  97. return permission_account_user($type);
  98. }
  99. }
  100. if (!function_exists('uni_permission')) {
  101. function uni_permission($uid = 0, $uniacid = 0) {
  102. return permission_account_user_role($uid, $uniacid);
  103. }
  104. }
  105. if (!function_exists('uni_user_permission_exist')) {
  106. function uni_user_permission_exist($uid = 0, $uniacid = 0) {
  107. return permission_account_user_permission_exist($uid, $uniacid);
  108. }
  109. }
  110. if (!function_exists('uni_user_permission_check')) {
  111. function uni_user_permission_check($permission_name = '', $show_message = true, $action = '') {
  112. return permission_check_account_user($permission_name, $show_message, $action);
  113. }
  114. }
  115. if (!defined('CACHE_KEY_MODULE_SETTING')) {
  116. define('CACHE_KEY_MODULE_SETTING', 'module_setting:%s:%s');
  117. }